import ReactDom from 'react-dom'; import React, { useState } from 'react'; import { Button, CssBaseline, Divider, IconButton, List, ListItem, Drawer, AppBar, Toolbar, Typography, InputBase, ListItemIcon, ListItemText, Menu, MenuItem, Hidden, Tooltip } from '@material-ui/core'; import { makeStyles, Theme, useTheme, fade } from '@material-ui/core/styles'; import { ChevronLeft, ChevronRight, Menu as MenuIcon, Search as SearchIcon, ArrowBack as ArrowBackIcon, AccountCircle } from '@material-ui/icons'; import {Link} from 'react-router-dom'; const drawerWidth = 240; const useStyles = makeStyles((theme: Theme) => ({ root: { display: 'flex' }, appBar: { zIndex: theme.zIndex.drawer + 1, transition: theme.transitions.create(['width', 'margin'], { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.leavingScreen }) }, menuButton: { marginRight: 36 }, hide: { display: "none" }, drawer: { flexShrink: 0, whiteSpace: "nowrap", [theme.breakpoints.up("sm")]:{ width: drawerWidth, }, }, drawerPaper: { width: drawerWidth }, drawerClose: { overflowX: 'hidden', [theme.breakpoints.up("sm")]:{ width: theme.spacing(7) + 1, }, }, toolbar: { ...theme.mixins.toolbar, }, content: { display:'flex', flexFlow: 'column', flexGrow: 1, padding: theme.spacing(3), }, title: { display: 'none', [theme.breakpoints.up("sm")]: { display: 'block' } }, search: { position: 'relative', borderRadius: theme.shape.borderRadius, backgroundColor: fade(theme.palette.common.white, 0.15), '&:hover': { backgroundColor: fade(theme.palette.common.white, 0.25), }, marginRight: theme.spacing(2), marginLeft: 0, width: '100%', [theme.breakpoints.up('sm')]: { marginLeft: theme.spacing(3), width: 'auto', }, }, searchIcon: { padding: theme.spacing(0, 2), height: '100%', position: 'absolute', pointerEvents: 'none', display: 'flex', alignItems: 'center', justifyContent: 'center', }, inputRoot: { color: 'inherit' }, inputInput: { padding: theme.spacing(1, 1, 1, 0), // vertical padding + font size from searchIcon paddingLeft: `calc(1em + ${theme.spacing(4)}px)`, transition: theme.transitions.create('width'), width: '100%', [theme.breakpoints.up('md')]: { width: '20ch', "&:hover": { width: '25ch' } }, }, grow: { flexGrow: 1, }, })); export const Headline = (prop: { children?: React.ReactNode, navListItem?: React.ReactNode, isLogin?:boolean}) => { const [v, setv] = useState(false); const [anchorEl, setAnchorEl] = React.useState(null); const classes = useStyles(); const theme = useTheme(); const toggleV = () => setv(!v); const handleProfileMenuOpen = (e:React.MouseEvent)=>setAnchorEl(e.currentTarget); const handleProfileMenuClose = ()=>setAnchorEl(null); const isProfileMenuOpened = Boolean(anchorEl); const menuId = 'primary-search-account-menu'; const isLogin = prop.isLogin || false; const renderProfileMenu = ( Profile Logout ); const drawer_contents = (<>
{theme.direction === "ltr" ? : }
{prop.navListItem} ); return (
Ionian
{ isLogin ? : }
{renderProfileMenu}
{prop.children}
); }; export default Headline;