mirror of
https://github.com/Nezumi-2711/react-training.git
synced 2026-09-23 04:19:48 +00:00
Add comments, constants for path and tag element
This commit is contained in:
@@ -1,22 +1,27 @@
|
|||||||
import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
|
import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
|
||||||
|
|
||||||
|
// Components
|
||||||
import AppLayout from './ui/AppLayout';
|
import AppLayout from './ui/AppLayout';
|
||||||
import User from './pages/User';
|
import User from './pages/User';
|
||||||
import Dashboard from './pages/Dashboard';
|
import Dashboard from './pages/Dashboard';
|
||||||
import Room from './pages/Room';
|
import Room from './pages/Room';
|
||||||
import NotFound from './pages/NotFound';
|
import NotFound from './pages/NotFound';
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
import * as PATH from './constants/path';
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route element={<AppLayout />}>
|
<Route element={<AppLayout />}>
|
||||||
<Route index element={<Navigate replace to="user" />} />
|
<Route index element={<Navigate replace to={PATH.USER} />} />
|
||||||
<Route path="dashboard" element={<Dashboard />} />
|
<Route path={PATH.DASHBOARD} element={<Dashboard />} />
|
||||||
<Route path="user" element={<User />} />
|
<Route path={PATH.USER} element={<User />} />
|
||||||
<Route path="room" element={<Room />} />
|
<Route path={PATH.ROOM} element={<Room />} />
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="*" element={<NotFound />} />
|
<Route path={PATH.OTHER_PATH} element={<NotFound />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export const DASHBOARD: string = '/dashboard';
|
||||||
|
export const USER: string = '/user';
|
||||||
|
export const ROOM: string = '/room';
|
||||||
|
export const OTHER_PATH: string = '*';
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
import { Outlet } from 'react-router-dom';
|
||||||
|
|
||||||
|
// Components
|
||||||
import Header from './Header';
|
import Header from './Header';
|
||||||
import Sidebar from './Sidebar';
|
import Sidebar from './Sidebar';
|
||||||
import { Outlet } from 'react-router-dom';
|
|
||||||
|
|
||||||
const StyledAppLayout = styled.div`
|
const StyledAppLayout = styled.div`
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
// Components
|
||||||
import HeaderMenu from './HeaderMenu';
|
import HeaderMenu from './HeaderMenu';
|
||||||
|
|
||||||
const StyledHeader = styled.header`
|
const StyledHeader = styled.header`
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import ButtonIcon from './ButtonIcon';
|
|
||||||
import { IoPersonCircleOutline } from 'react-icons/io5';
|
import { IoPersonCircleOutline } from 'react-icons/io5';
|
||||||
import { HiOutlineLogout } from 'react-icons/hi';
|
import { HiOutlineLogout } from 'react-icons/hi';
|
||||||
|
|
||||||
|
// Components
|
||||||
|
import ButtonIcon from './ButtonIcon';
|
||||||
|
|
||||||
const StyledHeaderMenu = styled.ul`
|
const StyledHeaderMenu = styled.ul`
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { MdSpaceDashboard } from 'react-icons/md';
|
|||||||
import { HiUsers } from 'react-icons/hi2';
|
import { HiUsers } from 'react-icons/hi2';
|
||||||
import { BsHouseDoorFill } from 'react-icons/bs';
|
import { BsHouseDoorFill } from 'react-icons/bs';
|
||||||
|
|
||||||
const StyledNav = styled.div`
|
const StyledNav = styled.nav`
|
||||||
margin-top: 70px;
|
margin-top: 70px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
// Components
|
||||||
import Nav from './Nav';
|
import Nav from './Nav';
|
||||||
|
|
||||||
const StyledSidebar = styled.aside`
|
const StyledSidebar = styled.aside`
|
||||||
|
|||||||
Reference in New Issue
Block a user