Skip to content

Commit

Permalink
website: update loading style. #50
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Nov 14, 2021
1 parent b74fa3b commit 30962ba
Showing 1 changed file with 18 additions and 41 deletions.
59 changes: 18 additions & 41 deletions website/src/pages/root/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { routes } from '../../router';
import Header from '../../components/Header';

const Loading = (
<div style={{ padding: 30 }}>
<div style={{ padding: 30, textAlign: 'center' }}>
<Loader tip="loading..." />
</div>
);
Expand All @@ -20,47 +20,24 @@ export default function Root() {
<div style={{ backgroundColor: hsvaToHslaString(hsva), transition: 'background-color 0.3s ease 0s', minHeight: '100%' }}>
<GitHubCorners fixed zIndex={99} size={60} target="__blank" href="https://github.com/uiwjs/react-color" />
<Header menus={routes} />
<Suspense
fallback={
<div style={{ padding: 30, textAlign: 'center' }}>
<Loader tip="loading..." />
</div>
}
>
<Routes>
{routes.map(({ component: Child, path }, idx) => {
// @ts-ignore
const Com = Child as any;
return (
<Route
key={idx}
path={path}
element={
<Suspense fallback={Loading}>
<Com />
</Suspense>
}
/>
);
// if (route.divider) {
// return null;
// }
// return <RouteWithSubRoutes key={idx} {...route} />;
})}
</Routes>
</Suspense>
<Routes>
{routes.map(({ component: Child, path }, idx) => {
// @ts-ignore
const Com = Child as any;
return (
<Route
key={idx}
path={path}
element={
<Suspense fallback={Loading}>
<Com />
</Suspense>
}
/>
);
})}
</Routes>
</div>
</HashRouter>
);
}

// function RouteWithSubRoutes(route: any) {
// return (
// <Route
// path={route.path}
// render={(props) => {
// return <route.component {...props} routes={route.routes} />;
// }}
// />
// );
// }

0 comments on commit 30962ba

Please sign in to comment.