-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from geostreams/release/3.6.0
Release/3.6.0
- Loading branch information
Showing
118 changed files
with
4,120 additions
and
1,397 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
// @flow | ||
import * as React from 'react'; | ||
import clsx from 'clsx'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
import { | ||
Container, | ||
Drawer, | ||
IconButton | ||
} | ||
from '@material-ui/core'; | ||
import ChevronLeftIcon from '@material-ui/icons/ChevronLeft'; | ||
import ChevronRightIcon from '@material-ui/icons/ChevronRight'; | ||
|
||
/* | ||
BaseSidebar creates an animated collapsible empty sidebar. | ||
Props: | ||
- classes: Override default classes | ||
- Non-Collapsible Sidebar | ||
- no extra props required | ||
- Collapsible Sidebar | ||
- collapsible: Shows the collapse control button on bottom | ||
- expanded: Boolean value of whether to open or close sidebar | ||
- toggleSidebar: Controls whether its open or not | ||
*/ | ||
|
||
const drawerWidth = 400; | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
drawer: { | ||
width: drawerWidth, | ||
zIndex: theme.zIndex.drawer | ||
}, | ||
drawerPaper:{ | ||
width: drawerWidth, | ||
borderRight: 'none', | ||
paddingTop: 65, | ||
overflowX: 'hidden', | ||
justifyContent: 'space-between' | ||
}, | ||
drawerOpen: { | ||
width: drawerWidth, | ||
transition: theme.transitions.create('width', { | ||
easing: theme.transitions.easing.sharp, | ||
duration: theme.transitions.duration.enteringScreen | ||
}) | ||
}, | ||
drawerClose: { | ||
transition: theme.transitions.create('width', { | ||
easing: theme.transitions.easing.sharp, | ||
duration: theme.transitions.duration.leavingScreen | ||
}), | ||
overflow: 'hidden', | ||
width: theme.spacing(7) + 1, | ||
[theme.breakpoints.up('sm')]: { | ||
width: theme.spacing(9) + 1 | ||
} | ||
}, | ||
toolbar: { | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'flex-end', | ||
padding: '0 8px' | ||
}, | ||
content: props => ({ | ||
alignItems: 'flex-start', | ||
padding:0, | ||
width: drawerWidth - 15, | ||
marginRight: 15, | ||
marginLeft: 5, | ||
paddingBottom: 10, | ||
...props.classes.content | ||
}) | ||
|
||
})); | ||
|
||
type Props = { | ||
children?: React.Node, | ||
collapsible?: boolean, | ||
toggleSidebar: Function, | ||
// eslint-disable-next-line react/no-unused-prop-types | ||
classes: Object, | ||
expanded: boolean | ||
} | ||
|
||
function BaseSidebar(props: Props) { | ||
|
||
const classes = useStyles(props); | ||
const open = props.expanded; | ||
|
||
// fire resize events when sidebar is toggled to update other components in tree (map) | ||
// multiple events to smooth out the updates | ||
React.useEffect(() => { | ||
const duration = open ? 195 : 225; | ||
|
||
for (let i = 0; i < duration + 100; i += 10) { | ||
setTimeout( | ||
()=>{window.dispatchEvent(new Event('resize'));}, | ||
i | ||
); | ||
} | ||
|
||
}, [open]); | ||
|
||
|
||
|
||
return ( | ||
<> | ||
<Drawer | ||
variant="permanent" | ||
className={clsx(classes.drawer, { | ||
[classes.drawerOpen]: open, | ||
[classes.drawerClose]: !open | ||
})} | ||
PaperProps={{ elevation: 3 }} | ||
classes={{ | ||
paper: clsx(classes.drawerPaper, { | ||
[classes.drawerOpen]: open, | ||
[classes.drawerClose]: !open | ||
}) | ||
}} | ||
> | ||
<Container className={classes.content}> | ||
{props.children} | ||
</Container> | ||
{props.collapsible ? | ||
<div className={classes.toolbar}> | ||
<IconButton onClick={()=> props.toggleSidebar(!open)}> | ||
{open ? <ChevronLeftIcon /> : <ChevronRightIcon /> } | ||
</IconButton> | ||
</div> : | ||
null} | ||
</Drawer> | ||
</> | ||
); | ||
} | ||
|
||
BaseSidebar.defaultProps = { | ||
children: null, | ||
collapsible: false, | ||
classes: {}, | ||
expanded: true | ||
}; | ||
|
||
export default BaseSidebar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
// @flow | ||
import * as React from 'react'; | ||
import clsx from 'clsx'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
import ExpandMore from '@material-ui/icons/ExpandMore'; | ||
import { | ||
Box, | ||
Collapse, | ||
List, | ||
ListItem, | ||
Grid | ||
} from '@material-ui/core'; | ||
|
||
/* | ||
Renders collapsible category component in sidebar. | ||
Props: | ||
- title | ||
- children | ||
- idx - required for mapping | ||
- classes - override default classes | ||
*/ | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
root: { | ||
height: 'auto', | ||
overflowX: 'hidden', | ||
overflowY: 'auto', | ||
backgroundColor: theme.palette.background.paper | ||
}, | ||
open : { | ||
transform: 'rotate(180deg)' | ||
}, | ||
close: { | ||
transform: 'rotate(0deg)' | ||
}, | ||
header: props => ({ | ||
justifyContent: 'space-between', | ||
alignItems: 'stretch', | ||
marginLeft: 4, | ||
marginRight: 4, | ||
...props.classes.header, | ||
background: props.backgroundColor | ||
}), | ||
icon: props => ({ | ||
position: 'absolute', | ||
right: 6, | ||
bottom: 4, | ||
transition: theme.transitions.create(['transform'], { | ||
duration: theme.transitions.duration.short | ||
}), | ||
...props.classes.icon | ||
}), | ||
content: props => ({ | ||
paddingLeft: theme.spacing(1), | ||
...props.classes.content | ||
}) | ||
})); | ||
|
||
type Props = { | ||
defaultOpen?: boolean; | ||
children?: React.Node, | ||
title: React.Node, | ||
// eslint-disable-next-line react/no-unused-prop-types | ||
classes: Object | ||
} | ||
|
||
function SidebarCategories(props: Props) { | ||
const classes = useStyles(props); | ||
const [open, toggleOpen] = React.useState(props.defaultOpen); | ||
return ( | ||
<List | ||
className={`${classes.root} noPadding`} | ||
subheader={ | ||
<Box | ||
button disableRipple disableGutters dense | ||
borderRadius={4} | ||
component={ListItem} | ||
onClick={()=>toggleOpen(!open)} | ||
> | ||
<Grid container className={classes.header} justify="space-between" alignitems="center" > | ||
{props.title} | ||
<ExpandMore className={clsx(classes.icon,{ | ||
[classes.open]: open, | ||
[classes.close]: !open | ||
})} /> | ||
</Grid> | ||
</Box> | ||
} | ||
> | ||
<Collapse in={open} className={classes.content} unmountOnExit timeout="auto"> | ||
{props.children} | ||
</Collapse> | ||
</List> | ||
); | ||
} | ||
|
||
SidebarCategories.defaultProps = { | ||
defaultOpen: false, | ||
children: null, | ||
classes: null | ||
}; | ||
|
||
export default SidebarCategories; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.