From bfa9f7b9158faa3a453eaabf5be3c96b6c8a18b1 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 10 Oct 2020 13:39:08 +0300 Subject: refactor: remove demo components from lib --- src/demo/Header/Header.tsx | 81 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 src/demo/Header/Header.tsx (limited to 'src/demo/Header/Header.tsx') diff --git a/src/demo/Header/Header.tsx b/src/demo/Header/Header.tsx new file mode 100644 index 0000000..58be989 --- /dev/null +++ b/src/demo/Header/Header.tsx @@ -0,0 +1,81 @@ +import React from 'react'; + +import { + AppBar, + Tabs, + Tab, + Typography, + Toolbar, +} from '@material-ui/core'; + +import { makeStyles } from '@material-ui/core/styles'; + + +interface PropTypes { + logo: { + icon: React.ReactNode; + title: string; + }; + contents: { + [key: string]: React.ReactNode | null; + }; + page: string; + setPage: (newPage: string) => void; +} + +const useStyles = makeStyles(theme => ({ + root: { + background: theme.palette.background.elevation2, + color: theme.palette.text.primary, + paddingLeft: theme.spacing(3), + }, + logo: { + margin: theme.spacing(0, 3, 0, 1), + }, + tab: { + '& .MuiTab-wrapper': { + padding: theme.spacing(2), + flexDirection: 'row', + fontSize: '0.8125rem', + '& svg': { + marginRight: theme.spacing(1), + marginBottom: '0 !important', + }, + }, + }, +})); + + +const Header: React.FC = ({ + logo, contents, page, setPage, +}) => { + const classes = useStyles(); + + const handleChange = (event: React.ChangeEvent<{}>, newPage: string): void => { + setPage(newPage); + }; + + return ( + + + {logo.icon} + + {logo.title} + + + {contents && Object.keys(contents).map((item: string) => ( + + ))} + + + + ); +}; + +export default Header; -- cgit v1.2.3