From ddb2ba73406d6982e81bc779c155e6c687f98bb5 Mon Sep 17 00:00:00 2001 From: Eug-VS Date: Mon, 3 Feb 2020 20:19:57 +0300 Subject: feat: separate HeaderTab component @asketonim, feel free to correct these changes --- src/lib/Header/Header.tsx | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Header/Header.tsx b/src/lib/Header/Header.tsx index 2b13e3f..cc73fd9 100644 --- a/src/lib/Header/Header.tsx +++ b/src/lib/Header/Header.tsx @@ -10,14 +10,13 @@ import { import { makeStyles } from '@material-ui/core/styles'; - interface PropTypes { logo: { icon: React.ReactNode; title: string; }; contents: { - [key: string]: React.ReactNode; + [key: string]: React.ReactNode | null; }; page: string; setPage: any; @@ -49,6 +48,19 @@ const useStyles = makeStyles((theme: any) => ({ const Header: React.FC = ({ logo, contents, page, setPage }) => { const classes = useStyles(); + const HeaderTab: React.FC<{ item: string }> = ({ item }) => { + const icon = contents[item]; + return ( + + ) + }; + const handleChange = (event: any, newPage: string) => { setPage(newPage); }; @@ -61,14 +73,8 @@ const Header: React.FC = ({ logo, contents, page, setPage }) => { {logo.title} - {contents && Object.keys(contents).map(item => ( - + {contents && Object.keys(contents).map((item: string) => ( + ))} -- cgit v1.2.3