testM.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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 './testIL';
  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. <AppBar position = "fixed"
  137. style = {
  138. { background: '#2196f3' }
  139. }
  140. className = {
  141. clsx(classes.appBar, {
  142. [classes.appBarShift]: open,
  143. })
  144. } >
  145. <
  146. Toolbar >
  147. <
  148. IconButton color = "inherit"
  149. onClick = { handleDrawerOpen }
  150. edge = "start"
  151. className = {
  152. clsx(classes.menuButton, {
  153. [classes.hide]: open,
  154. })
  155. } >
  156. <
  157. MenuIcon / >
  158. <
  159. /IconButton> <
  160. Typography variant = "h6"
  161. className = { classes.title } >
  162. 谷狗相薄 </Typography> <Button
  163. variant = "contained"
  164. startIcon = { < CloudUploadIcon / > } >
  165. Upload </Button><IconButton style={{ color: '#ffffff' }} aria-label="delete"> <
  166. HelpOutlineIcon / >
  167. </IconButton> <IconButton style={{ color: '#ffffff' }} aria-label="delete"> <
  168. SettingsIcon / >
  169. </IconButton> <Avatar alt="Remy Sharp" src="/static / images / avatar / 1. jpg " /> < /
  170. Toolbar > </AppBar>
  171. <Drawer variant = "permanent"
  172. className = {
  173. clsx(classes.drawer, {
  174. [classes.drawerOpen]: open,
  175. [classes.drawerClose]: !open,
  176. })
  177. }
  178. classes = {
  179. {
  180. paper: clsx({
  181. [classes.drawerOpen]: open,
  182. [classes.drawerClose]: !open,
  183. }),
  184. }
  185. } >
  186. <
  187. div className = { classes.toolbar } >
  188. <
  189. IconButton onClick = { handleDrawerClose } > { theme.direction === 'rtl' ? < ChevronRightIcon / > : < ChevronLeftIcon / > } <
  190. /IconButton> < /
  191. div > <
  192. Divider / >
  193. <
  194. List > {
  195. ['相片', '共享', '相簿', '實用工具'].map((text, index) => ( <
  196. ListItem button key = { text } >
  197. <
  198. ListItemIcon > { index == 0 ? < PhotoIcon / > : index == 1 ? < ShareIcon / > : index == 2 ? < PhotoAlbumIcon / > : < LibraryAddCheckIcon / > } < /ListItemIcon> <
  199. ListItemText primary = { text }
  200. /> < /
  201. ListItem >
  202. ))
  203. } <
  204. Divider / > {
  205. ['儲存空間'].map((text, index) => ( <
  206. ListItem button key = { text } >
  207. <
  208. ListItemIcon > { < CloudIcon / > } < /ListItemIcon> <
  209. ListItemText primary = { text }
  210. secondary = <
  211. BorderLinearProgress variant = "determinate"
  212. value = { 50 }
  213. /> / >
  214. <
  215. /
  216. ListItem >
  217. ))
  218. } < /
  219. List > < /
  220. Drawer > <
  221. main className = { classes.content } >
  222. <
  223. div className = { classes.toolbar }
  224. /> <
  225. ImageList / > < /
  226. main > < /
  227. div >
  228. );
  229. }