import {useState} from 'react' import PropTypes from 'prop-types' import Link from 'next/link' import { Grid, Toolbar, Typography, AppBar, CssBaseline, Drawer, Hidden, IconButton } from '@material-ui/core' import KeyboardBackspaceIcon from '@material-ui/icons/KeyboardBackspace' import MenuIcon from '@material-ui/icons/Menu' import {makeStyles, useTheme} from '@material-ui/core/styles' import DrawerBar from './drawer-bar' import DenyeTeks from './denye-teks' import VweKouteAchte from './vwe-koute-achte' const drawerWidth = 240 const useStyles = makeStyles(theme => ({ root: { display: 'flex' }, drawer: { marginTop: '10em', [theme.breakpoints.up('sm')]: { width: drawerWidth, flexShrink: 0 } }, appBar: { borderTop: '2px solid #303030', marginTop: '4.71rem', [theme.breakpoints.up('sm')]: { width: `calc(100% - ${drawerWidth}px)`, marginLeft: drawerWidth } }, menuButton: { [theme.breakpoints.up('sm')]: { display: 'none' } }, toolbar: theme.mixins.toolbar, drawerPaper: { borderTop: '2px solid #303030', marginTop: '4.71rem', width: drawerWidth }, content: { flexGrow: 1, padding: theme.spacing(3) }, list: { marginBottom: '6em' }, form: { marginLeft: theme.spacing(1) }, text: { marginBottom: '0.5em' }, gridText: { border: '1px dashed grey', borderRadius: '5px', marginTop: '2em', marginInline: '2px' }, grid: { marginTop: '1em' }, koute: { position: 'absolute', right: '1px', top: '8px', [theme.breakpoints.up('sm')]: { top: '10px' } }, vwe: { position: 'absolute', right: '60px', top: '8px', [theme.breakpoints.up('sm')]: { top: '10px' } } })) const formatJsonString = stringToFormat => { return stringToFormat.split('\n').map((string, index) =>
{`${string}`}
) // eslint-disable-line react/no-array-index-key } export default function TeksDrawer({teks, anTeks}) { const classes = useStyles() const theme = useTheme() const [mobileOpen, setMobileOpen] = useState(false) const handleDrawerToggle = () => { setMobileOpen(!mobileOpen) } const container = typeof window === 'undefined' ? undefined : () => window.document.body return (
{anTeks ? ( <> {anTeks.lyen && anTeks.lyen.length > 0 && (
)} {anTeks.kouteyAchtey && anTeks.kouteyAchtey.length > 0 && (
)} ) : ( Dènyé Tèks )}
{anTeks ? ( <> {anTeks.tit} Transcription {formatJsonString(anTeks.transkripsyon)} {anTeks.tradiksyon && ( Traduction {formatJsonString(anTeks.tradiksyon.francais)} )} ) : ( )}
) } TeksDrawer.propTypes = { teks: PropTypes.array.isRequired, anTeks: PropTypes.object } TeksDrawer.defaultProps = { anTeks: null }