Add routing with react-router-dom
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import React from 'react';
|
||||
import 'rsuite/lib/styles/index.less';
|
||||
import { Container } from 'rsuite';
|
||||
import { BrowserRouter as Router, Switch, Route, Link } from 'react-router-dom';
|
||||
|
||||
import Login from './Login';
|
||||
import Register from './Register';
|
||||
|
||||
import TopBar from '../components/Navbar/NavBar';
|
||||
import NavBar from '../components/Navbar/NavBar';
|
||||
|
||||
const containerStyle = {
|
||||
maxWidth: 700,
|
||||
@@ -16,13 +16,20 @@ const containerStyle = {
|
||||
marginBottom: '10vh',
|
||||
};
|
||||
|
||||
function App() {
|
||||
export default function App() {
|
||||
return (
|
||||
<Container style={containerStyle}>
|
||||
<TopBar />
|
||||
<Register />
|
||||
</Container>
|
||||
<Router>
|
||||
<Container style={containerStyle}>
|
||||
<NavBar />
|
||||
<Switch>
|
||||
<Route path='/login'>
|
||||
<Login />
|
||||
</Route>
|
||||
<Route path='/register'>
|
||||
<Register />
|
||||
</Route>
|
||||
</Switch>
|
||||
</Container>
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
||||
@@ -15,16 +15,12 @@ const boxStyle = {
|
||||
margin: '50px 10px',
|
||||
};
|
||||
|
||||
function Login() {
|
||||
export default function Login() {
|
||||
return (
|
||||
<Content>
|
||||
<FlexboxGrid justify='center'>
|
||||
<FlexboxGrid.Item>
|
||||
<Panel
|
||||
header={<h3>Login</h3>}
|
||||
bordered
|
||||
style={boxStyle}
|
||||
>
|
||||
<Panel header={<h3>Login</h3>} bordered style={boxStyle}>
|
||||
<Form horizontal>
|
||||
<FormGroup>
|
||||
<FormControl
|
||||
@@ -44,7 +40,9 @@ function Login() {
|
||||
</HelpBlock>
|
||||
</FormGroup>
|
||||
<FormGroup>
|
||||
<Button appearance='primary' block>Sign in</Button>
|
||||
<Button appearance='primary' block>
|
||||
Sign in
|
||||
</Button>
|
||||
</FormGroup>
|
||||
<Button appearance='link'>Forgot password?</Button>
|
||||
</Form>
|
||||
@@ -54,5 +52,3 @@ function Login() {
|
||||
</Content>
|
||||
);
|
||||
}
|
||||
|
||||
export default Login;
|
||||
|
||||
@@ -16,7 +16,7 @@ const boxStyle = {
|
||||
margin: '50px 10px',
|
||||
};
|
||||
|
||||
function Register() {
|
||||
export default function Register() {
|
||||
return (
|
||||
<Content>
|
||||
<FlexboxGrid justify='center'>
|
||||
@@ -48,7 +48,9 @@ function Register() {
|
||||
<Dropdown.Item>
|
||||
Alaska Standard Time
|
||||
</Dropdown.Item>
|
||||
<Dropdown.Item>Bangladesh Standard Time </Dropdown.Item>
|
||||
<Dropdown.Item>
|
||||
Bangladesh Standard Time{' '}
|
||||
</Dropdown.Item>
|
||||
<Dropdown.Item>...</Dropdown.Item>
|
||||
</Dropdown>
|
||||
</FormGroup>
|
||||
@@ -74,5 +76,3 @@ function Register() {
|
||||
</Content>
|
||||
);
|
||||
}
|
||||
|
||||
export default Register;
|
||||
|
||||
Reference in New Issue
Block a user