From a98e02f15e34e937f52ba40a84e26d9b5ef4e461 Mon Sep 17 00:00:00 2001 From: spacemeowx2 Date: Mon, 6 Mar 2023 22:01:18 +0800 Subject: [PATCH] feat: use react-router-dom's Link --- gui/src/App.tsx | 2 ++ gui/src/components/Loading.tsx | 5 +++-- gui/src/pages/Guide.tsx | 3 +++ gui/src/pages/Home.tsx | 3 ++- gui/src/pages/Settings.tsx | 3 ++- 5 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 gui/src/pages/Guide.tsx diff --git a/gui/src/App.tsx b/gui/src/App.tsx index eadea29..93133c3 100644 --- a/gui/src/App.tsx +++ b/gui/src/App.tsx @@ -5,6 +5,7 @@ import { Routes, Route } from "react-router-dom"; import { Layout } from "components/Layout"; import { Home } from "pages/Home"; import { Settings } from "pages/Settings"; +import { Guide } from 'pages/Guide'; function App() { useEffect(() => { @@ -19,6 +20,7 @@ function App() { }> } /> } /> + } /> ); diff --git a/gui/src/components/Loading.tsx b/gui/src/components/Loading.tsx index cb3789c..aba915d 100644 --- a/gui/src/components/Loading.tsx +++ b/gui/src/components/Loading.tsx @@ -2,8 +2,9 @@ import React from 'react' import { AiOutlineLoading3Quarters } from 'react-icons/ai'; type LoadingProps = { + className?: string } -export const Loading: React.FC = () => { - return +export const Loading: React.FC = ({ className }) => { + return } diff --git a/gui/src/pages/Guide.tsx b/gui/src/pages/Guide.tsx new file mode 100644 index 0000000..8a61a62 --- /dev/null +++ b/gui/src/pages/Guide.tsx @@ -0,0 +1,3 @@ +export const Guide: React.FC = () => { + return <> +} \ No newline at end of file diff --git a/gui/src/pages/Home.tsx b/gui/src/pages/Home.tsx index 0bd1ffe..179157d 100644 --- a/gui/src/pages/Home.tsx +++ b/gui/src/pages/Home.tsx @@ -1,5 +1,6 @@ import React from 'react' import { useTranslation } from 'react-i18next'; +import { Link } from "react-router-dom"; export const Home: React.FC = () => { const { t } = useTranslation(); @@ -7,7 +8,7 @@ export const Home: React.FC = () => { return <>
{t('欢迎!')} - {t('配置')} + {t('配置')}
} diff --git a/gui/src/pages/Settings.tsx b/gui/src/pages/Settings.tsx index 83ff952..0e112f9 100644 --- a/gui/src/pages/Settings.tsx +++ b/gui/src/pages/Settings.tsx @@ -1,3 +1,4 @@ +import { Loading } from 'components/Loading'; import { usePromise } from 'hooks/usePromise'; import React from 'react' import { useTranslation } from 'react-i18next'; @@ -13,7 +14,7 @@ export const Settings: React.FC = () => { } if (loading) { - return
{t('加载中...')}
+ return
} return <>