feat: add tags page

This commit is contained in:
monoid 2022-06-29 21:48:01 +09:00
parent 253311bbd7
commit 8d20c30d32
6 changed files with 30 additions and 5 deletions

View File

@ -1,7 +1,17 @@
import React, { createContext, useEffect, useRef, useState } from 'react'; import React, { createContext, useEffect, useRef, useState } from 'react';
import ReactDom from 'react-dom'; import ReactDom from 'react-dom';
import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom'; import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
import { Gallery, DocumentAbout, LoginPage, NotFoundPage, ProfilePage, DifferencePage, SettingPage, ReaderPage } from './page/mod'; import {
Gallery,
DocumentAbout,
LoginPage,
NotFoundPage,
ProfilePage,
DifferencePage,
SettingPage,
ReaderPage,
TagsPage
} from './page/mod';
import { getInitialValue, UserContext } from './state'; import { getInitialValue, UserContext } from './state';
import { ThemeProvider, createTheme } from '@mui/material'; import { ThemeProvider, createTheme } from '@mui/material';
@ -38,6 +48,7 @@ const App = () => {
<Route path="/profile" element={<ProfilePage />}></Route> <Route path="/profile" element={<ProfilePage />}></Route>
<Route path="/difference" element={<DifferencePage />}></Route> <Route path="/difference" element={<DifferencePage />}></Route>
<Route path="/setting" element={<SettingPage />}></Route> <Route path="/setting" element={<SettingPage />}></Route>
<Route path="/tags" element={<TagsPage />}></Route>
<Route path="*" element={<NotFoundPage />} /> <Route path="*" element={<NotFoundPage />} />
</Routes> </Routes>
</BrowserRouter> </BrowserRouter>

View File

@ -182,8 +182,6 @@ export const Headline = (prop: {
<Hidden xsDown implementation="css"> <Hidden xsDown implementation="css">
<StyledDrawer variant='permanent' anchor='left' <StyledDrawer variant='permanent' anchor='left'
sx={{ sx={{
overflowX: 'hidden',
width: theme.spacing(7) + 1,
...closedMixin(theme), ...closedMixin(theme),
'& .MuiDrawer-paper': closedMixin(theme), '& .MuiDrawer-paper': closedMixin(theme),
}}> }}>

View File

@ -2,6 +2,7 @@ import React from 'react';
import {List, ListItem, ListItemIcon, Tooltip, ListItemText, Divider} from '@mui/material'; import {List, ListItem, ListItemIcon, Tooltip, ListItemText, Divider} from '@mui/material';
import {ArrowBack as ArrowBackIcon, Settings as SettingIcon, import {ArrowBack as ArrowBackIcon, Settings as SettingIcon,
Collections as CollectionIcon, VideoLibrary as VideoIcon, Home as HomeIcon, Collections as CollectionIcon, VideoLibrary as VideoIcon, Home as HomeIcon,
List as ListIcon,
Folder as FolderIcon } from '@mui/icons-material'; Folder as FolderIcon } from '@mui/icons-material';
import {Link as RouterLink} from 'react-router-dom'; import {Link as RouterLink} from 'react-router-dom';
@ -29,11 +30,13 @@ export const BackItem = (props:{to?:string})=>{
export function CommonMenuList(props?:{url?:string}) { export function CommonMenuList(props?:{url?:string}) {
let url = props?.url ?? ""; let url = props?.url ?? "";
return (<NavList> return (<NavList>
{url !== "" && <><BackItem /> <Divider /></>} {url !== "" && <><BackItem to={url} /> <Divider /></>}
<NavItem name="All" to="/" icon={<HomeIcon />} /> <NavItem name="All" to="/" icon={<HomeIcon />} />
<NavItem name="Comic" to="/search?content_type=comic" icon={<CollectionIcon />}></NavItem> <NavItem name="Comic" to="/search?content_type=comic" icon={<CollectionIcon />}></NavItem>
<NavItem name="Video" to="/search?content_type=video" icon={<VideoIcon />} /> <NavItem name="Video" to="/search?content_type=video" icon={<VideoIcon />} />
<Divider /> <Divider />
<NavItem name="Tags" to="/tags" icon={<ListIcon/>}/>
<Divider />
<NavItem name="Difference" to="/difference" icon={<FolderIcon/>}></NavItem> <NavItem name="Difference" to="/difference" icon={<FolderIcon/>}></NavItem>
<NavItem name="Settings" to="/setting" icon={<SettingIcon />} /> <NavItem name="Settings" to="/setting" icon={<SettingIcon />} />
</NavList>); </NavList>);

View File

@ -5,3 +5,4 @@ export * from './404';
export * from './profile'; export * from './profile';
export * from './difference'; export * from './difference';
export * from './setting'; export * from './setting';
export * from './tags';

11
src/client/page/tags.tsx Normal file
View File

@ -0,0 +1,11 @@
import React from 'react';
import {Typography} from '@mui/material';
import { Headline, CommonMenuList } from '../component/mod';
export const TagsPage = ()=>{
const menu = CommonMenuList();
return <Headline menu={menu}>
<Typography variant='h2'>Tags</Typography>
</Headline>
};

View File

@ -116,6 +116,7 @@ class ServerApplication{
serveindex('/profile'); serveindex('/profile');
serveindex('/difference'); serveindex('/difference');
serveindex('/setting'); serveindex('/setting');
serveindex('/tags');
} }
private serve_static_file(router: Router){ private serve_static_file(router: Router){
const static_file_server = (path:string,type:string) => { const static_file_server = (path:string,type:string) => {