-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade components to better structure
- Loading branch information
Showing
28 changed files
with
97 additions
and
122 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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 |
---|---|---|
@@ -1,3 +1,32 @@ | ||
import AddButton from "./AddButton"; | ||
import React, { FunctionComponent } from "react"; | ||
import { Fab, Theme, makeStyles } from "@material-ui/core"; | ||
import AddIcon from "@material-ui/icons/Add"; | ||
|
||
const useStyles = makeStyles((theme: Theme) => ({ | ||
button: { | ||
position: "fixed", | ||
right: theme.spacing(3), | ||
bottom: theme.spacing(3), | ||
}, | ||
})); | ||
|
||
type AddButtonProps = { | ||
onClick: (...args: any[]) => any; | ||
}; | ||
|
||
const AddButton: FunctionComponent<AddButtonProps> = ({ onClick }) => { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<Fab | ||
color="secondary" | ||
aria-label="add" | ||
className={classes.button} | ||
onClick={onClick} | ||
> | ||
<AddIcon /> | ||
</Fab> | ||
); | ||
}; | ||
|
||
export default AddButton; |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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 |
---|---|---|
@@ -1,3 +1,65 @@ | ||
import Drawer from "./Drawer"; | ||
import React from "react"; | ||
import { | ||
Drawer as MaterialDrawer, | ||
Divider, | ||
IconButton, | ||
Theme, | ||
} from "@material-ui/core"; | ||
import ChevronLeftIcon from "@material-ui/icons/ChevronLeft"; | ||
import Menu from "../Menu"; | ||
import { MenuDataItem } from "../Menu"; | ||
import { makeStyles } from "@material-ui/styles"; | ||
|
||
export const DRAWER_WIDTH = 240; | ||
const useStyles = makeStyles((theme: Theme) => ({ | ||
drawerPaper: { | ||
width: DRAWER_WIDTH, | ||
}, | ||
|
||
drawerHeader: { | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "flex-end", | ||
padding: "0 8px", | ||
height: theme.spacing(8), | ||
}, | ||
})); | ||
|
||
type DrawerProps = { | ||
data: MenuDataItem[]; | ||
isOpen?: boolean; | ||
onClose: (...args: any[]) => any; | ||
redirectTo: (...args: any[]) => any; | ||
}; | ||
|
||
const Drawer: React.SFC<DrawerProps> = ({ | ||
data, | ||
isOpen = false, | ||
onClose, | ||
redirectTo, | ||
}) => { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<MaterialDrawer | ||
variant="persistent" | ||
classes={{ | ||
paper: classes.drawerPaper, | ||
}} | ||
anchor="left" | ||
open={isOpen} | ||
> | ||
<div className={classes.drawerHeader}> | ||
<IconButton onClick={onClose}> | ||
<ChevronLeftIcon /> | ||
</IconButton> | ||
</div> | ||
|
||
<Divider /> | ||
|
||
<Menu data={data} redirectTo={redirectTo} /> | ||
</MaterialDrawer> | ||
); | ||
}; | ||
|
||
export default Drawer; |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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