From 7ad6c6a2a454c8abec4958f859bb5aacf0b213f1 Mon Sep 17 00:00:00 2001 From: hexi1997 <18715156450@163.com> Date: Sat, 1 Jul 2023 15:03:12 +0800 Subject: [PATCH 1/3] chore: add paths on tsconfig --- tsconfig.json | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index e4b81e9..8133513 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,7 +17,12 @@ "moduleResolution": "Node", "resolveJsonModule": true, "isolatedModules": true, - "jsx": "preserve" + "jsx": "preserve", + "paths": { + "@/*": [ + "./*" + ] + } }, "include": [ "next-env.d.ts", @@ -26,5 +31,6 @@ ], "exclude": [ "node_modules" - ] + ], + } From 73719cc5c723c40c2055fbd26c716c6e780954fd Mon Sep 17 00:00:00 2001 From: hexi1997 <18715156450@163.com> Date: Sat, 1 Jul 2023 15:14:43 +0800 Subject: [PATCH 2/3] feat: extract app-layout and footer component --- components/app-layout.tsx | 14 ++++++++++++++ components/footer.tsx | 34 ++++++++++++++++++++++++++++++++++ components/index.tsx | 2 ++ pages/_app.tsx | 7 ++++++- pages/index.tsx | 34 ++-------------------------------- 5 files changed, 58 insertions(+), 33 deletions(-) create mode 100644 components/app-layout.tsx create mode 100644 components/footer.tsx create mode 100644 components/index.tsx diff --git a/components/app-layout.tsx b/components/app-layout.tsx new file mode 100644 index 0000000..d0d48be --- /dev/null +++ b/components/app-layout.tsx @@ -0,0 +1,14 @@ +import { ReactNode } from "react"; +import { Footer } from "./footer"; + +interface IAppLayoutProps { + children: ReactNode; +} +export function AppLayout({ children }: IAppLayoutProps) { + return ( + <> + {children} + + > + ); +} diff --git a/components/footer.tsx b/components/footer.tsx new file mode 100644 index 0000000..71c1dbf --- /dev/null +++ b/components/footer.tsx @@ -0,0 +1,34 @@ +import Link from "next/link"; + +export function Footer() { + return +} \ No newline at end of file diff --git a/components/index.tsx b/components/index.tsx new file mode 100644 index 0000000..ac7cb77 --- /dev/null +++ b/components/index.tsx @@ -0,0 +1,2 @@ +export * from './app-layout' +export * from './model-change' \ No newline at end of file diff --git a/pages/_app.tsx b/pages/_app.tsx index 26aa5dd..4c63a3b 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -1,8 +1,13 @@ import { AppProps } from "next/app"; import "../styles/globals.css"; +import { AppLayout } from "@/components"; function App({ Component, pageProps }: AppProps) { - return ; + return ( + + + + ); } export default App; diff --git a/pages/index.tsx b/pages/index.tsx index 4003f1d..228359c 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -12,7 +12,7 @@ import { useAtom, useAtomValue, useSetAtom } from "jotai/react"; import { atom } from "jotai/vanilla"; import { Observable } from "rxjs"; import Link from "next/link"; -import { Model, ModelChange } from "../components/model-change"; +import { Model, ModelChange } from "@/components"; export const SendButton = styled.button` background: "transparent"; @@ -275,37 +275,7 @@ export default function App() { - - + From 892f6e6958a4234447fed12d469cd3a0c479f140 Mon Sep 17 00:00:00 2001 From: hexi1997 <18715156450@163.com> Date: Sat, 1 Jul 2023 15:23:12 +0800 Subject: [PATCH 3/3] refactor: footer --- components/footer.tsx | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/components/footer.tsx b/components/footer.tsx index 71c1dbf..68c1313 100644 --- a/components/footer.tsx +++ b/components/footer.tsx @@ -1,13 +1,14 @@ import Link from "next/link"; export function Footer() { - return