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