testM.js 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. import React from 'react';
  2. import { makeStyles, useTheme, withStyles } from '@material-ui/core/styles';
  3. import AppBar from '@material-ui/core/AppBar';
  4. import Toolbar from '@material-ui/core/Toolbar';
  5. import Typography from '@material-ui/core/Typography';
  6. import Button from '@material-ui/core/Button';
  7. import IconButton from '@material-ui/core/IconButton';
  8. import MenuIcon from '@material-ui/icons/Menu';
  9. import clsx from 'clsx';
  10. import Drawer from '@material-ui/core/Drawer';
  11. import List from '@material-ui/core/List';
  12. import CssBaseline from '@material-ui/core/CssBaseline';
  13. import Divider from '@material-ui/core/Divider';
  14. import ChevronLeftIcon from '@material-ui/icons/ChevronLeft';
  15. import ChevronRightIcon from '@material-ui/icons/ChevronRight';
  16. import ListItem from '@material-ui/core/ListItem';
  17. import ListItemIcon from '@material-ui/core/ListItemIcon';
  18. import ListItemText from '@material-ui/core/ListItemText';
  19. import InboxIcon from '@material-ui/icons/MoveToInbox';
  20. import MailIcon from '@material-ui/icons/Mail';
  21. import ImageList from './ImageList';
  22. import PhotoIcon from '@material-ui/icons/Photo';
  23. import ShareIcon from '@material-ui/icons/Share';
  24. import PhotoAlbumIcon from '@material-ui/icons/PhotoAlbum';
  25. import LibraryAddCheckIcon from '@material-ui/icons/LibraryAddCheck';
  26. import Grid from '@material-ui/core/Grid';
  27. import DeleteIcon from '@material-ui/icons/Delete';
  28. import CloudUploadIcon from '@material-ui/icons/CloudUpload';
  29. import HelpOutlineIcon from '@material-ui/icons/HelpOutline';
  30. import SettingsIcon from '@material-ui/icons/Settings';
  31. import Avatar from '@material-ui/core/Avatar';
  32. import Icon from '@material-ui/core/Icon';
  33. import AddCircle from '@material-ui/icons/AddCircle';
  34. import CloudIcon from '@material-ui/icons/Cloud';
  35. import LinearProgress from '@material-ui/core/LinearProgress';
  36. const drawerWidth = 240;
  37. const BorderLinearProgress = withStyles((theme) => ({
  38. colorPrimary: {
  39. backgroundColor: theme.palette.grey[theme.palette.type === 'light' ? 200 : 700],
  40. },
  41. bar: {
  42. borderRadius: 5,
  43. backgroundColor: '#1a90ff',
  44. },
  45. }))(LinearProgress);
  46. const useStyles = makeStyles((theme) => ({
  47. root: {
  48. flexGrow: 1,
  49. },
  50. menuButton: {
  51. marginRight: theme.spacing(2),
  52. },
  53. title: {
  54. flexGrow: 1,
  55. },
  56. toolbar: {
  57. display: 'flex',
  58. alignItems: 'center',
  59. justifyContent: 'flex-end',
  60. padding: theme.spacing(0, 1),
  61. // necessary for content to be below app bar
  62. ...theme.mixins.toolbar,
  63. },
  64. root: {
  65. display: 'flex',
  66. },
  67. appBar: {
  68. zIndex: theme.zIndex.drawer + 1,
  69. transition: theme.transitions.create(['width', 'margin'], {
  70. easing: theme.transitions.easing.sharp,
  71. duration: theme.transitions.duration.leavingScreen,
  72. }),
  73. },
  74. appBarShift: {
  75. marginLeft: drawerWidth,
  76. width: `calc(100% - ${drawerWidth}px)`,
  77. transition: theme.transitions.create(['width', 'margin'], {
  78. easing: theme.transitions.easing.sharp,
  79. duration: theme.transitions.duration.enteringScreen,
  80. }),
  81. },
  82. menuButton: {
  83. marginRight: 36,
  84. },
  85. hide: {
  86. display: 'none',
  87. },
  88. drawer: {
  89. width: drawerWidth,
  90. flexShrink: 0,
  91. whiteSpace: 'nowrap',
  92. },
  93. drawerOpen: {
  94. width: drawerWidth,
  95. transition: theme.transitions.create('width', {
  96. easing: theme.transitions.easing.sharp,
  97. duration: theme.transitions.duration.enteringScreen,
  98. }),
  99. },
  100. drawerClose: {
  101. transition: theme.transitions.create('width', {
  102. easing: theme.transitions.easing.sharp,
  103. duration: theme.transitions.duration.leavingScreen,
  104. }),
  105. overflowX: 'hidden',
  106. width: theme.spacing(7) + 1,
  107. [theme.breakpoints.up('sm')]: {
  108. width: theme.spacing(9) + 1,
  109. },
  110. },
  111. toolbar: {
  112. display: 'flex',
  113. alignItems: 'center',
  114. justifyContent: 'flex-end',
  115. padding: theme.spacing(0, 1),
  116. // necessary for content to be below app bar
  117. ...theme.mixins.toolbar,
  118. },
  119. content: {
  120. flexGrow: 1,
  121. padding: theme.spacing(3),
  122. },
  123. }));
  124. export default function ButtonAppBar() {
  125. const classes = useStyles();
  126. const [open, setOpen] = React.useState(false);
  127. const theme = useTheme();
  128. const handleDrawerOpen = () => {
  129. setOpen(true);
  130. };
  131. const handleDrawerClose = () => {
  132. setOpen(false);
  133. };
  134. return ( <
  135. div className = { classes.root } >
  136. <
  137. AppBar position = "fixed"
  138. className = {
  139. clsx(classes.appBar, {
  140. [classes.appBarShift]: open,
  141. })
  142. } >
  143. <
  144. Toolbar >
  145. <
  146. IconButton color = "inherit"
  147. onClick = { handleDrawerOpen }
  148. edge = "start"
  149. className = {
  150. clsx(classes.menuButton, {
  151. [classes.hide]: open,
  152. })
  153. } >
  154. <
  155. MenuIcon / >
  156. <
  157. /IconButton> <
  158. Typography variant = "h6"
  159. className = { classes.title } >
  160. 谷狗相薄 <
  161. /Typography> <Button
  162. variant = "contained"
  163. startIcon = { < CloudUploadIcon / > } >
  164. Upload <
  165. /Button><IconButton style={{ color: '#ffffff' }} aria-label="delete"> <
  166. CloudUploadIcon / >
  167. <
  168. /IconButton> <IconButton style={{ color: '#ffffff' }} aria-label="delete"> <
  169. HelpOutlineIcon / >
  170. <
  171. /IconButton> <IconButton style={{ color: '#ffffff' }} aria-label="delete"> <
  172. SettingsIcon / >
  173. <
  174. /IconButton> <Avatar alt="Remy Sharp" src="/static / images / avatar / 1. jpg " /> < /
  175. Toolbar > <
  176. /AppBar> < Drawer variant = "permanent"
  177. className = {
  178. clsx(classes.drawer, {
  179. [classes.drawerOpen]: open,
  180. [classes.drawerClose]: !open,
  181. })
  182. }
  183. classes = {
  184. {
  185. paper: clsx({
  186. [classes.drawerOpen]: open,
  187. [classes.drawerClose]: !open,
  188. }),
  189. }
  190. } >
  191. <
  192. div className = { classes.toolbar } >
  193. <
  194. IconButton onClick = { handleDrawerClose } > { theme.direction === 'rtl' ? < ChevronRightIcon / > : < ChevronLeftIcon / > } <
  195. /IconButton> < /
  196. div > <
  197. Divider / >
  198. <
  199. List > {
  200. ['相片', '共享', '相簿', '實用工具'].map((text, index) => ( <
  201. ListItem button key = { text } >
  202. <
  203. ListItemIcon > { index == 0 ? < PhotoIcon / > : index == 1 ? < ShareIcon / > : index == 2 ? < PhotoAlbumIcon / > : < LibraryAddCheckIcon / > } < /ListItemIcon> <
  204. ListItemText primary = { text }
  205. /> < /
  206. ListItem >
  207. ))
  208. } <
  209. Divider / > {
  210. ['儲存空間'].map((text, index) => ( <
  211. ListItem button key = { text } >
  212. <
  213. ListItemIcon > { < CloudIcon / > } < /ListItemIcon> <
  214. ListItemText primary = { text }
  215. secondary = <
  216. BorderLinearProgress variant = "determinate"
  217. value = { 50 }
  218. /> / >
  219. <
  220. /
  221. ListItem >
  222. ))
  223. } < /
  224. List > < /
  225. Drawer > <
  226. main className = { classes.content } >
  227. <
  228. div className = { classes.toolbar }
  229. /> <
  230. ImageList / > < /
  231. main > < /
  232. div >
  233. );
  234. }