Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

289 linhas
11 KiB

  1. import React from "react";
  2. // react plugin for creating date-time-picker
  3. import Datetime from "react-datetime";
  4. // @material-ui/core components
  5. import { makeStyles } from "@material-ui/core/styles";
  6. import Slide from "@material-ui/core/Slide";
  7. import IconButton from "@material-ui/core/IconButton";
  8. import Dialog from "@material-ui/core/Dialog";
  9. import DialogTitle from "@material-ui/core/DialogTitle";
  10. import DialogContent from "@material-ui/core/DialogContent";
  11. import DialogActions from "@material-ui/core/DialogActions";
  12. import InputLabel from "@material-ui/core/InputLabel";
  13. import FormControl from "@material-ui/core/FormControl";
  14. import Tooltip from "@material-ui/core/Tooltip";
  15. import Popover from "@material-ui/core/Popover";
  16. // @material-ui/icons
  17. import LibraryBooks from "@material-ui/icons/LibraryBooks";
  18. import Close from "@material-ui/icons/Close";
  19. // core components
  20. import GridContainer from "components/Grid/GridContainer.js";
  21. import GridItem from "components/Grid/GridItem.js";
  22. import Button from "components/CustomButtons/Button.js";
  23. import styles from "assets/jss/nextjs-material-kit/pages/componentsSections/javascriptStyles.js";
  24. const useStyles = makeStyles(styles);
  25. const Transition = React.forwardRef(function Transition(props, ref) {
  26. return <Slide direction="down" ref={ref} {...props} />;
  27. });
  28. Transition.displayName = "Transition";
  29. export default function SectionJavascript() {
  30. const classes = useStyles();
  31. const [anchorElLeft, setAnchorElLeft] = React.useState(null);
  32. const [anchorElTop, setAnchorElTop] = React.useState(null);
  33. const [anchorElBottom, setAnchorElBottom] = React.useState(null);
  34. const [anchorElRight, setAnchorElRight] = React.useState(null);
  35. const [classicModal, setClassicModal] = React.useState(false);
  36. return (
  37. <div className={classes.section}>
  38. <div className={classes.container}>
  39. <div className={classes.title}>
  40. <h2>Javascript components</h2>
  41. </div>
  42. <GridContainer>
  43. <GridItem xs={12} sm={12} md={6}>
  44. <div className={classes.title}>
  45. <h3>Modal</h3>
  46. </div>
  47. <GridContainer>
  48. <GridItem xs={12} sm={12} md={6} lg={4}>
  49. <Button
  50. color="primary"
  51. block
  52. onClick={() => setClassicModal(true)}
  53. >
  54. <LibraryBooks className={classes.icon} />
  55. Classic
  56. </Button>
  57. <Dialog
  58. classes={{
  59. root: classes.center,
  60. paper: classes.modal
  61. }}
  62. open={classicModal}
  63. TransitionComponent={Transition}
  64. keepMounted
  65. onClose={() => setClassicModal(false)}
  66. aria-labelledby="classic-modal-slide-title"
  67. aria-describedby="classic-modal-slide-description"
  68. >
  69. <DialogTitle
  70. id="classic-modal-slide-title"
  71. disableTypography
  72. className={classes.modalHeader}
  73. >
  74. <IconButton
  75. className={classes.modalCloseButton}
  76. key="close"
  77. aria-label="Close"
  78. color="inherit"
  79. onClick={() => setClassicModal(false)}
  80. >
  81. <Close className={classes.modalClose} />
  82. </IconButton>
  83. <h4 className={classes.modalTitle}>Modal title</h4>
  84. </DialogTitle>
  85. <DialogContent
  86. id="classic-modal-slide-description"
  87. className={classes.modalBody}
  88. >
  89. <p>
  90. Far far away, behind the word mountains, far from the
  91. countries Vokalia and Consonantia, there live the blind
  92. texts. Separated they live in Bookmarksgrove right at the
  93. coast of the Semantics, a large language ocean. A small
  94. river named Duden flows by their place and supplies it
  95. with the necessary regelialia. It is a paradisematic
  96. country, in which roasted parts of sentences fly into your
  97. mouth. Even the all-powerful Pointing has no control about
  98. the blind texts it is an almost unorthographic life One
  99. day however a small line of blind text by the name of
  100. Lorem Ipsum decided to leave for the far World of Grammar.
  101. </p>
  102. </DialogContent>
  103. <DialogActions className={classes.modalFooter}>
  104. <Button color="transparent" simple>
  105. Nice Button
  106. </Button>
  107. <Button
  108. onClick={() => setClassicModal(false)}
  109. color="danger"
  110. simple
  111. >
  112. Close
  113. </Button>
  114. </DialogActions>
  115. </Dialog>
  116. </GridItem>
  117. </GridContainer>
  118. <GridItem xs={12} sm={12} md={12}>
  119. <div className={classes.title}>
  120. <h3>Datetime Picker</h3>
  121. </div>
  122. <GridContainer>
  123. <GridItem xs={12} sm={12} md={6}>
  124. <InputLabel className={classes.label}>
  125. Datetime Picker
  126. </InputLabel>
  127. <br />
  128. <FormControl fullWidth>
  129. <Datetime
  130. inputProps={{ placeholder: "Datetime Picker Here" }}
  131. />
  132. </FormControl>
  133. </GridItem>
  134. </GridContainer>
  135. </GridItem>
  136. </GridItem>
  137. <GridItem xs={12} sm={12} md={6}>
  138. <div className={classes.title}>
  139. <h3>Popovers</h3>
  140. </div>
  141. <Button onClick={event => setAnchorElLeft(event.currentTarget)}>
  142. On left
  143. </Button>
  144. <Popover
  145. classes={{
  146. paper: classes.popover
  147. }}
  148. open={Boolean(anchorElLeft)}
  149. anchorEl={anchorElLeft}
  150. onClose={() => setAnchorElLeft(null)}
  151. anchorOrigin={{
  152. vertical: "center",
  153. horizontal: "left"
  154. }}
  155. transformOrigin={{
  156. vertical: "center",
  157. horizontal: "right"
  158. }}
  159. >
  160. <h3 className={classes.popoverHeader}>Popover on left</h3>
  161. <div className={classes.popoverBody}>
  162. Here will be some very useful information about his popover.
  163. Here will be some very useful information about his popover.
  164. </div>
  165. </Popover>
  166. <Button onClick={event => setAnchorElTop(event.currentTarget)}>
  167. On top
  168. </Button>
  169. <Popover
  170. classes={{
  171. paper: classes.popover
  172. }}
  173. open={Boolean(anchorElTop)}
  174. anchorEl={anchorElTop}
  175. onClose={() => setAnchorElTop(null)}
  176. anchorOrigin={{
  177. vertical: "top",
  178. horizontal: "center"
  179. }}
  180. transformOrigin={{
  181. vertical: "bottom",
  182. horizontal: "center"
  183. }}
  184. >
  185. <h3 className={classes.popoverHeader}>Popover on top</h3>
  186. <div className={classes.popoverBody}>
  187. Here will be some very useful information about his popover.
  188. </div>
  189. </Popover>
  190. <Button onClick={event => setAnchorElBottom(event.currentTarget)}>
  191. On bottom
  192. </Button>
  193. <Popover
  194. classes={{
  195. paper: classes.popover
  196. }}
  197. open={Boolean(anchorElBottom)}
  198. anchorEl={anchorElBottom}
  199. onClose={() => setAnchorElBottom(null)}
  200. anchorOrigin={{
  201. vertical: "bottom",
  202. horizontal: "center"
  203. }}
  204. transformOrigin={{
  205. vertical: "top",
  206. horizontal: "center"
  207. }}
  208. >
  209. <h3 className={classes.popoverHeader}>Popover on bottom</h3>
  210. <div className={classes.popoverBody}>
  211. Here will be some very useful information about his popover.
  212. </div>
  213. </Popover>
  214. <Button onClick={event => setAnchorElRight(event.currentTarget)}>
  215. On right
  216. </Button>
  217. <Popover
  218. classes={{
  219. paper: classes.popover
  220. }}
  221. open={Boolean(anchorElRight)}
  222. anchorEl={anchorElRight}
  223. onClose={() => setAnchorElRight(null)}
  224. anchorOrigin={{
  225. vertical: "center",
  226. horizontal: "right"
  227. }}
  228. transformOrigin={{
  229. vertical: "center",
  230. horizontal: "left"
  231. }}
  232. >
  233. <h3 className={classes.popoverHeader}>Popover on right</h3>
  234. <div className={classes.popoverBody}>
  235. Here will be some very useful information about his popover.
  236. </div>
  237. </Popover>
  238. <br />
  239. <br />
  240. <div className={classes.title}>
  241. <h3>Tooltips</h3>
  242. </div>
  243. <Tooltip
  244. id="tooltip-left"
  245. title="Tooltip on left"
  246. placement="left"
  247. classes={{ tooltip: classes.tooltip }}
  248. >
  249. <Button>On left</Button>
  250. </Tooltip>
  251. <Tooltip
  252. id="tooltip-top"
  253. title="Tooltip on top"
  254. placement="top"
  255. classes={{ tooltip: classes.tooltip }}
  256. >
  257. <Button>On top</Button>
  258. </Tooltip>
  259. <Tooltip
  260. id="tooltip-bottom"
  261. title="Tooltip on bottom"
  262. placement="bottom"
  263. classes={{ tooltip: classes.tooltip }}
  264. >
  265. <Button>On bottom</Button>
  266. </Tooltip>
  267. <Tooltip
  268. id="tooltip-right"
  269. title="Tooltip on right"
  270. placement="right"
  271. classes={{ tooltip: classes.tooltip }}
  272. >
  273. <Button>On right</Button>
  274. </Tooltip>
  275. </GridItem>
  276. </GridContainer>
  277. <div className={classes.title}>
  278. <h3>Carousel</h3>
  279. </div>
  280. </div>
  281. </div>
  282. );
  283. }