feat: add graphql support (#349)
* fix: eslint warnings * refactor: use ramda + sanctuary instead of lodash * refactor: use prettier-standard for formatting * feat: enable security * feat: add graphql * chore: remove trailing commas from linter * docs: new scripts on react and new-admin-server * feat: handle authentication on graphql * fix: perf improvement to date picker * chore: add insecure-dev script to run servers
This commit is contained in:
parent
49f434f1d1
commit
b8e0c2175b
182 changed files with 8827 additions and 4623 deletions
|
|
@ -1,10 +1,14 @@
|
|||
import React, { useState, memo } from 'react'
|
||||
import classnames from 'classnames'
|
||||
import { makeStyles } from '@material-ui/core/styles'
|
||||
import classnames from 'classnames'
|
||||
import React, { useState, memo } from 'react'
|
||||
|
||||
import Popover from '../Popper'
|
||||
import { subheaderColor, subheaderDarkColor, offColor } from '../../styling/variables'
|
||||
import typographyStyles from '../typography/styles'
|
||||
import {
|
||||
subheaderColor,
|
||||
subheaderDarkColor,
|
||||
offColor
|
||||
} from 'src/styling/variables'
|
||||
import Popover from 'src/components/Popper'
|
||||
import typographyStyles from 'src/components/typography/styles'
|
||||
|
||||
const { info2 } = typographyStyles
|
||||
|
||||
|
|
@ -58,56 +62,74 @@ const styles = {
|
|||
|
||||
const useStyles = makeStyles(styles)
|
||||
|
||||
const IDButton = memo(({ name, className, Icon, InverseIcon, popoverWidth = 152, children, ...props }) => {
|
||||
const [anchorEl, setAnchorEl] = useState(null)
|
||||
const IDButton = memo(
|
||||
({
|
||||
name,
|
||||
className,
|
||||
Icon,
|
||||
InverseIcon,
|
||||
popoverWidth = 152,
|
||||
children,
|
||||
...props
|
||||
}) => {
|
||||
const [anchorEl, setAnchorEl] = useState(null)
|
||||
|
||||
const classes = useStyles()
|
||||
const classes = useStyles()
|
||||
|
||||
const open = Boolean(anchorEl)
|
||||
const id = open ? `simple-popper-${name}` : undefined
|
||||
const open = Boolean(anchorEl)
|
||||
const id = open ? `simple-popper-${name}` : undefined
|
||||
|
||||
const classNames = {
|
||||
[classes.idButton]: true,
|
||||
[classes.primary]: true,
|
||||
[classes.open]: open,
|
||||
[classes.closed]: !open
|
||||
const classNames = {
|
||||
[classes.idButton]: true,
|
||||
[classes.primary]: true,
|
||||
[classes.open]: open,
|
||||
[classes.closed]: !open
|
||||
}
|
||||
|
||||
const iconClassNames = {
|
||||
[classes.buttonIcon]: true
|
||||
}
|
||||
|
||||
const handleClick = event => {
|
||||
setAnchorEl(anchorEl ? null : event.currentTarget)
|
||||
}
|
||||
|
||||
const handleClose = () => {
|
||||
setAnchorEl(null)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<button
|
||||
aria-describedby={id}
|
||||
onClick={handleClick}
|
||||
className={classnames(classNames, className)}
|
||||
{...props}>
|
||||
{Icon && !open && (
|
||||
<div className={classnames(iconClassNames)}>
|
||||
<Icon />
|
||||
</div>
|
||||
)}
|
||||
{InverseIcon && open && (
|
||||
<div className={classnames(iconClassNames)}>
|
||||
<InverseIcon />
|
||||
</div>
|
||||
)}
|
||||
</button>
|
||||
<Popover
|
||||
id={id}
|
||||
open={open}
|
||||
anchorEl={anchorEl}
|
||||
onClose={handleClose}
|
||||
arrowSize={3}
|
||||
placement="top">
|
||||
<div className={classes.popoverContent}>
|
||||
<div>{children}</div>
|
||||
</div>
|
||||
</Popover>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
const iconClassNames = {
|
||||
[classes.buttonIcon]: true
|
||||
}
|
||||
|
||||
const handleClick = event => {
|
||||
setAnchorEl(anchorEl ? null : event.currentTarget)
|
||||
}
|
||||
|
||||
const handleClose = () => {
|
||||
setAnchorEl(null)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<button aria-describedby={id} onClick={handleClick} className={classnames(classNames, className)} {...props}>
|
||||
{Icon && !open && <div className={classnames(iconClassNames)}><Icon /></div>}
|
||||
{InverseIcon && open &&
|
||||
<div className={classnames(iconClassNames)}>
|
||||
<InverseIcon />
|
||||
</div>}
|
||||
</button>
|
||||
<Popover
|
||||
id={id}
|
||||
open={open}
|
||||
anchorEl={anchorEl}
|
||||
onClose={handleClose}
|
||||
arrowSize={3}
|
||||
placement='top'
|
||||
>
|
||||
<div className={classes.popoverContent}>
|
||||
<div>{children}</div>
|
||||
</div>
|
||||
</Popover>
|
||||
</>
|
||||
)
|
||||
})
|
||||
)
|
||||
|
||||
export default IDButton
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue