import React from "react";
import { Route, Routes } from "react-router-dom";
import { ConfigProvider } from "antd";
import zhCN from "antd/locale/zh_CN";
import { MemoSpinLoding } from "./components";
import theme from "./theme.scss";
import "./App.scss";

const Login = React.lazy(() => import("./pages/Login"));
const Layout = React.lazy(() => import("./pages/Layout"));

function App() {
  return (
    <div className="App">
      <ConfigProvider
        locale={zhCN}
        theme={{ token: { colorPrimary: theme.primaryColor } }}
      >
        <React.Suspense fallback={<MemoSpinLoding />}>
          <Routes>
            <Route path="/login" Component={Login} />
            <Route path="/*" Component={Layout} />
          </Routes>
        </React.Suspense>
      </ConfigProvider>
    </div>
  );
}

export default App;
