From a26ac4f21779461a7e9ce82cada0b4952ad93d22 Mon Sep 17 00:00:00 2001 From: chenos Date: Wed, 17 May 2023 18:06:19 +0800 Subject: [PATCH] docs: routes demo --- .../client/src/route-switch/demos/demo1.tsx | 44 +++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/packages/core/client/src/route-switch/demos/demo1.tsx b/packages/core/client/src/route-switch/demos/demo1.tsx index 66b3e08ad..15dd6cb71 100644 --- a/packages/core/client/src/route-switch/demos/demo1.tsx +++ b/packages/core/client/src/route-switch/demos/demo1.tsx @@ -1,9 +1,18 @@ +import { RouteRedirectProps, RouteSwitch, RouteSwitchProvider } from '@nocobase/client'; import React from 'react'; import { Link, MemoryRouter as Router } from 'react-router-dom'; -import { RouteRedirectProps, RouteSwitchProvider, RouteSwitch } from '@nocobase/client'; const Home = () =>

Home

; const About = () =>

About

; +const SignIn = () =>

Sign In

; +const SignUp = () =>

Sign Up

; + +const AuthLayout = (props) => ( +
+

AuthLayout

+ {props.children} +
+); const routes: RouteRedirectProps[] = [ { @@ -17,13 +26,42 @@ const routes: RouteRedirectProps[] = [ path: '/about', component: 'About', }, + { + type: 'route', + component: 'AuthLayout', + routes: [ + { + type: 'route', + path: '/signin', + component: 'SignIn', + }, + { + type: 'route', + path: '/signup', + component: 'SignUp', + }, + ], + }, ]; export default () => { return ( - + - Home, About +
    +
  • + Home +
  • +
  • + About +
  • +
  • + Sign In +
  • +
  • + Sign Up +
  • +