实现主界面定位。
This commit is contained in:
parent
e2183bcbd2
commit
99d12b483d
@ -1,5 +1,5 @@
|
|||||||
import './App.css';
|
import './App.css';
|
||||||
import { Routes,Route, Redirect } from 'react-router-dom'
|
import { Routes, Route, Redirect } from 'react-router-dom'
|
||||||
import LoginPage from './LoginPage';
|
import LoginPage from './LoginPage';
|
||||||
import MainPage from './MainPage';
|
import MainPage from './MainPage';
|
||||||
|
|
||||||
@ -7,8 +7,8 @@ function App() {
|
|||||||
return (
|
return (
|
||||||
<div className="App">
|
<div className="App">
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route exact path="/login" element={<LoginPage/>} />
|
<Route exact path="/login" element={<LoginPage />} />
|
||||||
<Route exact path="/main" element={<MainPage/>} />
|
<Route exact path="/" element={<MainPage />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
import { render, screen } from '@testing-library/react';
|
|
||||||
import App from './App';
|
|
||||||
|
|
||||||
test('renders learn react link', () => {
|
|
||||||
render(<App />);
|
|
||||||
const linkElement = screen.getByText(/learn react/i);
|
|
||||||
expect(linkElement).toBeInTheDocument();
|
|
||||||
});
|
|
@ -14,7 +14,7 @@ import AdbIcon from '@mui/icons-material/Adb';
|
|||||||
|
|
||||||
const settings = ['Profile', 'Account', 'Dashboard', 'Logout'];
|
const settings = ['Profile', 'Account', 'Dashboard', 'Logout'];
|
||||||
|
|
||||||
export default function(){
|
export default function () {
|
||||||
const [anchorElUser, setAnchorElUser] = React.useState(null);
|
const [anchorElUser, setAnchorElUser] = React.useState(null);
|
||||||
const handleOpenUserMenu = (event) => {
|
const handleOpenUserMenu = (event) => {
|
||||||
setAnchorElUser(event.currentTarget);
|
setAnchorElUser(event.currentTarget);
|
||||||
@ -24,7 +24,7 @@ export default function(){
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return <AppBar sx={{ zIndex: (theme) => theme.zIndex.drawer + 1 }} position="fixed">
|
return <AppBar sx={{ zIndex: (theme) => theme.zIndex.drawer + 1 }} position="sticky">
|
||||||
<Container maxWidth="xl">
|
<Container maxWidth="xl">
|
||||||
<Toolbar disableGutters>
|
<Toolbar disableGutters>
|
||||||
<AdbIcon sx={{ display: { xs: 'none', md: 'flex' }, mr: 1 }} />
|
<AdbIcon sx={{ display: { xs: 'none', md: 'flex' }, mr: 1 }} />
|
||||||
@ -60,5 +60,5 @@ export default function(){
|
|||||||
</Box>
|
</Box>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
</Container>
|
</Container>
|
||||||
</AppBar>
|
</AppBar>
|
||||||
}
|
}
|
@ -1,9 +1,26 @@
|
|||||||
import AppBar from './AppBar';
|
import AppBar from './AppBar';
|
||||||
import RecordList from './RecordList';
|
import RecordList from './RecordList';
|
||||||
|
import PlayerBar from './PlayerBar';
|
||||||
|
import styles from './MainPage.module.css';
|
||||||
|
import { CssBaseline, Box, Container, Typography } from '@mui/material';
|
||||||
|
import RecordLyrics from './RecordLyrics';
|
||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
return <div>
|
return <div>
|
||||||
|
<CssBaseline />
|
||||||
<AppBar />
|
<AppBar />
|
||||||
<RecordList />
|
<RecordList />
|
||||||
</div>
|
<Box
|
||||||
|
component="main"
|
||||||
|
sx={{
|
||||||
|
width: `calc(100% - 240px)`, ml: `240px`
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Typography>2022-12-13 14:39_同传翻译</Typography>
|
||||||
|
<PlayerBar />
|
||||||
|
<RecordLyrics />
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
|
||||||
|
</div >
|
||||||
}
|
}
|
3
src/MainPage.module.css
Normal file
3
src/MainPage.module.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.title {
|
||||||
|
background-color: burlywood;
|
||||||
|
}
|
25
src/PlayerBar.js
Normal file
25
src/PlayerBar.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { Grid, MenuItem, Select, FormControl, InputLabel, Button } from "@mui/material"
|
||||||
|
import styles from './PlayerBar.module.css';
|
||||||
|
|
||||||
|
export default function () {
|
||||||
|
return <Grid container>
|
||||||
|
<Grid item lg={1}> <Button>播放</Button> </Grid>
|
||||||
|
<Grid item lg={10}> <div>进度条</div></Grid>
|
||||||
|
<Grid item lg={1}>
|
||||||
|
<FormControl fullWidth>
|
||||||
|
<InputLabel id="demo-simple-select-label">速度</InputLabel>
|
||||||
|
<Select
|
||||||
|
labelId="demo-simple-select-label"
|
||||||
|
id="demo-simple-select"
|
||||||
|
label="速度"
|
||||||
|
>
|
||||||
|
<MenuItem value={10}>0.5X</MenuItem>
|
||||||
|
<MenuItem value={20}>1.0X</MenuItem>
|
||||||
|
<MenuItem value={30}>1.25X</MenuItem>
|
||||||
|
<MenuItem value={30}>1.5X</MenuItem>
|
||||||
|
<MenuItem value={30}>2.0X</MenuItem>
|
||||||
|
</Select>
|
||||||
|
</FormControl>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
}
|
3
src/PlayerBar.module.css
Normal file
3
src/PlayerBar.module.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.playerBar {
|
||||||
|
display: flex;
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
import React from 'react';
|
||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
import Drawer from '@mui/material/Drawer';
|
import Drawer from '@mui/material/Drawer';
|
||||||
import List from '@mui/material/List';
|
import List from '@mui/material/List';
|
||||||
@ -6,12 +7,39 @@ import ListItemButton from '@mui/material/ListItemButton';
|
|||||||
import ListItemIcon from '@mui/material/ListItemIcon';
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
||||||
import ListItemText from '@mui/material/ListItemText';
|
import ListItemText from '@mui/material/ListItemText';
|
||||||
import Toolbar from '@mui/material/Toolbar';
|
import Toolbar from '@mui/material/Toolbar';
|
||||||
|
import { CssBaseline } from '@mui/material';
|
||||||
import InboxIcon from '@mui/icons-material/MoveToInbox';
|
|
||||||
import MailIcon from '@mui/icons-material/Mail';
|
|
||||||
|
|
||||||
const drawerWidth = 240;
|
const drawerWidth = 240;
|
||||||
|
|
||||||
|
|
||||||
|
const recordList = [
|
||||||
|
{
|
||||||
|
title: "2022-12-14 14:39_同传翻译",
|
||||||
|
time: "2022-12-14 14:39",
|
||||||
|
content: "当面对重重困难,你感觉举步维艰的时候,回想你以前是如何坚持到底战胜困难的最后时刻的。这样,你就会发现你有能力克服每个障碍。"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "2022-12-14 14:39_同传翻译",
|
||||||
|
time: "2022-12-14 14:39",
|
||||||
|
content: "当面对重重困难,你感觉举步维艰的时候,回想你以前是如何坚持到底战胜困难的最后时刻的。这样,你就会发现你有能力克服每个障碍。"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "2022-12-14 14:39_同传翻译",
|
||||||
|
time: "2022-12-14 14:39",
|
||||||
|
content: "当面对重重困难,你感觉举步维艰的时候,回想你以前是如何坚持到底战胜困难的最后时刻的。这样,你就会发现你有能力克服每个障碍。"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "2022-12-14 14:39_同传翻译",
|
||||||
|
time: "2022-12-14 14:39",
|
||||||
|
content: "当面对重重困难,你感觉举步维艰的时候,回想你以前是如何坚持到底战胜困难的最后时刻的。这样,你就会发现你有能力克服每个障碍。"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "2022-12-14 14:39_同传翻译",
|
||||||
|
time: "2022-12-14 14:39",
|
||||||
|
content: "当面对重重困难,你感觉举步维艰的时候,回想你以前是如何坚持到底战胜困难的最后时刻的。这样,你就会发现你有能力克服每个障碍。"
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
return <Drawer
|
return <Drawer
|
||||||
variant="permanent"
|
variant="permanent"
|
||||||
@ -24,25 +52,15 @@ export default function () {
|
|||||||
<Toolbar />
|
<Toolbar />
|
||||||
<Box sx={{ overflow: 'auto' }}>
|
<Box sx={{ overflow: 'auto' }}>
|
||||||
<List>
|
<List>
|
||||||
{['Inbox', 'Starred', 'Send email', 'Drafts'].map((text, index) => (
|
{recordList.map((item, index) => (
|
||||||
<ListItem key={text} disablePadding>
|
<ListItem key={index} disablePadding>
|
||||||
<ListItemButton>
|
<ListItemButton>
|
||||||
<ListItemIcon>
|
<ListItemText primary={item.title} secondary={
|
||||||
{index % 2 === 0 ? <InboxIcon /> : <MailIcon />}
|
<React.Fragment>
|
||||||
</ListItemIcon>
|
<div>{item.content}</div>
|
||||||
<ListItemText primary={text} />
|
<div>更新于 {item.time}</div>
|
||||||
</ListItemButton>
|
</React.Fragment>
|
||||||
</ListItem>
|
} />
|
||||||
))}
|
|
||||||
</List>
|
|
||||||
<List>
|
|
||||||
{['All mail', 'Trash', 'Spam'].map((text, index) => (
|
|
||||||
<ListItem key={text} disablePadding>
|
|
||||||
<ListItemButton>
|
|
||||||
<ListItemIcon>
|
|
||||||
{index % 2 === 0 ? <InboxIcon /> : <MailIcon />}
|
|
||||||
</ListItemIcon>
|
|
||||||
<ListItemText primary={text} />
|
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
))}
|
))}
|
||||||
|
66
src/RecordLyrics.js
Normal file
66
src/RecordLyrics.js
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
import { Typography } from "@mui/material";
|
||||||
|
import styles from './RecordLyrics.module.css';
|
||||||
|
|
||||||
|
const lyrics = [
|
||||||
|
{
|
||||||
|
original: "当你身陷困境的时候(你有时会),回想你生命中快乐和幸福的时刻。回想它是如何使你快乐,你便有了走出困境的勇气。",
|
||||||
|
translation: "When times become difficult (and you know they sometimes will), remember a moment in your life that was filled with joy and happiness. Remember how it made you feel, and you will have the strength you need to get through any trial.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
original: "当面对重重困难,你感觉举步维艰的时候,回想你以前是如何坚持到底战胜困难的最后时刻的。这样,你就会发现你有能力克服每个障碍。",
|
||||||
|
translation: "When life throws you one more obstacle than you think you can handle, remember something you achieved through perseverance and by struggling to the end. In doing so, you'll find you have the ability to overcome each obstacle brought your way.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
original: "当你觉得精疲力尽的时候,暂时离开,让自己稍作休息。",
|
||||||
|
translation: "When you find yourself drained and depleted of energy, remember to find a place of sanctuary and rest.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
original: "当你身陷困境的时候(你有时会),回想你生命中快乐和幸福的时刻。回想它是如何使你快乐,你便有了走出困境的勇气。",
|
||||||
|
translation: "When times become difficult (and you know they sometimes will), remember a moment in your life that was filled with joy and happiness. Remember how it made you feel, and you will have the strength you need to get through any trial.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
original: "当面对重重困难,你感觉举步维艰的时候,回想你以前是如何坚持到底战胜困难的最后时刻的。这样,你就会发现你有能力克服每个障碍。",
|
||||||
|
translation: "When life throws you one more obstacle than you think you can handle, remember something you achieved through perseverance and by struggling to the end. In doing so, you'll find you have the ability to overcome each obstacle brought your way.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
original: "当你觉得精疲力尽的时候,暂时离开,让自己稍作休息。",
|
||||||
|
translation: "When you find yourself drained and depleted of energy, remember to find a place of sanctuary and rest.",
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
original: "当你身陷困境的时候(你有时会),回想你生命中快乐和幸福的时刻。回想它是如何使你快乐,你便有了走出困境的勇气。",
|
||||||
|
translation: "When times become difficult (and you know they sometimes will), remember a moment in your life that was filled with joy and happiness. Remember how it made you feel, and you will have the strength you need to get through any trial.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
original: "当面对重重困难,你感觉举步维艰的时候,回想你以前是如何坚持到底战胜困难的最后时刻的。这样,你就会发现你有能力克服每个障碍。",
|
||||||
|
translation: "When life throws you one more obstacle than you think you can handle, remember something you achieved through perseverance and by struggling to the end. In doing so, you'll find you have the ability to overcome each obstacle brought your way.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
original: "当你觉得精疲力尽的时候,暂时离开,让自己稍作休息。",
|
||||||
|
translation: "When you find yourself drained and depleted of energy, remember to find a place of sanctuary and rest.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
original: "当你身陷困境的时候(你有时会),回想你生命中快乐和幸福的时刻。回想它是如何使你快乐,你便有了走出困境的勇气。",
|
||||||
|
translation: "When times become difficult (and you know they sometimes will), remember a moment in your life that was filled with joy and happiness. Remember how it made you feel, and you will have the strength you need to get through any trial.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
original: "当面对重重困难,你感觉举步维艰的时候,回想你以前是如何坚持到底战胜困难的最后时刻的。这样,你就会发现你有能力克服每个障碍。",
|
||||||
|
translation: "When life throws you one more obstacle than you think you can handle, remember something you achieved through perseverance and by struggling to the end. In doing so, you'll find you have the ability to overcome each obstacle brought your way.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
original: "当你觉得精疲力尽的时候,暂时离开,让自己稍作休息。",
|
||||||
|
translation: "When you find yourself drained and depleted of energy, remember to find a place of sanctuary and rest.",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
export default function () {
|
||||||
|
return <div className={styles.lyricsBrowser}>
|
||||||
|
{lyrics.map((lyric, index) => {
|
||||||
|
return <div className={styles.lyricItem}>
|
||||||
|
<Typography align="left">{lyric.original}</Typography>
|
||||||
|
<Typography align="left">{lyric.translation}</Typography>
|
||||||
|
</div>
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
}
|
7
src/RecordLyrics.module.css
Normal file
7
src/RecordLyrics.module.css
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
.lyricsBrowser {
|
||||||
|
padding-bottom: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lyricItem {
|
||||||
|
padding-bottom: 40px;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user