mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-15 16:51:37 +00:00
Fix some little issues
This commit is contained in:
@ -7,7 +7,7 @@ import Home from 'pages/index';
|
||||
|
||||
describe('Home', () => {
|
||||
it('renders a heading', () => {
|
||||
render(<Home />);
|
||||
render(<Home totalNum={0} pagingSize={0} allPages={0} postDatas={[]} />);
|
||||
|
||||
const heading = screen.getByText(/hello/i);
|
||||
|
||||
|
@ -25,7 +25,7 @@ const SearchBox: FC = () => {
|
||||
|
||||
const handleInput: ChangeEventHandler<HTMLInputElement> = useCallback(
|
||||
(e) => {
|
||||
dispatch({ type: ActionKind.SETQUERY, playload: e.target.value });
|
||||
dispatch({ type: ActionKind.SETQUERY, payload: e.target.value });
|
||||
},
|
||||
[dispatch]
|
||||
);
|
||||
|
@ -6,7 +6,7 @@ export enum ActionKind {
|
||||
|
||||
type ReducerAction = {
|
||||
type: ActionKind;
|
||||
playload: string;
|
||||
payload: string;
|
||||
};
|
||||
|
||||
type State = {
|
||||
@ -22,10 +22,10 @@ const initialState: State = {
|
||||
};
|
||||
|
||||
const reducer = (state: State, action: ReducerAction): State => {
|
||||
const { type, playload } = action;
|
||||
const { type, payload } = action;
|
||||
switch (type) {
|
||||
case ActionKind.SETQUERY:
|
||||
return { searchQuery: playload };
|
||||
return { searchQuery: payload };
|
||||
default:
|
||||
throw new Error();
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import RUAStore from '../lib/store';
|
||||
const H2 = dynamic(() => import('components/MDX/MDXH2'));
|
||||
|
||||
// MDX components
|
||||
const mdxCompoents = {
|
||||
const mdxComponents = {
|
||||
h2: H2,
|
||||
};
|
||||
|
||||
@ -38,7 +38,7 @@ function MyApp({ Component, pageProps }: AppPropsWithLayout) {
|
||||
</Head>
|
||||
|
||||
<RUAStore>
|
||||
<MDXProvider components={mdxCompoents}>
|
||||
<MDXProvider components={mdxComponents}>
|
||||
{getLayout(<Component {...pageProps} />)}
|
||||
</MDXProvider>
|
||||
</RUAStore>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import AboutMDXLayout from 'layouts/MDXLayout';
|
||||
import { FiGithub, FiExternalLink } from 'react-icons/fi';
|
||||
import { FiGithub } from 'react-icons/fi';
|
||||
import RUALink from 'components/RUA/RUALink';
|
||||
|
||||
<AboutMDXLayout title="RUA - About">
|
||||
|
@ -1,13 +1,13 @@
|
||||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
||||
import type { NextApiRequest, NextApiResponse } from 'next'
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
|
||||
type Data = {
|
||||
name: string
|
||||
}
|
||||
name: string;
|
||||
};
|
||||
|
||||
export default function handler(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse<Data>
|
||||
) {
|
||||
res.status(200).json({ name: 'John Doe' })
|
||||
res.status(200).json({ name: 'xfy!' });
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ const Search = () => {
|
||||
const { state, dispatch } = useRUAContext();
|
||||
|
||||
const handleInput: ChangeEventHandler<HTMLInputElement> = (e) => {
|
||||
dispatch({ type: ActionKind.SETQUERY, playload: e.target.value });
|
||||
dispatch({ type: ActionKind.SETQUERY, payload: e.target.value });
|
||||
};
|
||||
|
||||
return (
|
||||
|
Reference in New Issue
Block a user