-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a0fa760
commit 0d38710
Showing
3 changed files
with
95 additions
and
6 deletions.
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
src/frontend/src/components/StreamTabPanel/StreamTabPanel.jsx
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
import Tabs from '@material-ui/core/Tabs'; | ||
import Tab from '@material-ui/core/Tab'; | ||
import Typography from '@material-ui/core/Typography'; | ||
import Box from '@material-ui/core/Box'; | ||
import VideocamIcon from '@material-ui/icons/Videocam'; | ||
import ChatIcon from '@material-ui/icons/Chat'; | ||
|
||
function TabPanel(props) { | ||
const { children, value, index, ...other } = props; | ||
|
||
return ( | ||
<div | ||
role="tabpanel" | ||
hidden={value !== index} | ||
id={`vertical-tabpanel-${index}`} | ||
aria-labelledby={`vertical-tab-${index}`} | ||
{...other} | ||
> | ||
{value === index && ( | ||
<Box p={18}> | ||
<Typography>{children}</Typography> | ||
</Box> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
TabPanel.propTypes = { | ||
children: PropTypes.node, | ||
index: PropTypes.any.isRequired, | ||
value: PropTypes.any.isRequired, | ||
}; | ||
|
||
function a11yProps(index) { | ||
return { | ||
id: `vertical-tab-${index}`, | ||
'aria-controls': `vertical-tabpanel-${index}`, | ||
}; | ||
} | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
root: { | ||
display: 'flex', | ||
backgroundColor: theme.palette.background.paper, | ||
}, | ||
tabs: { | ||
borderLeft: `1px solid ${theme.palette.divider}`, | ||
width: '40px', | ||
}, | ||
})); | ||
|
||
export default function StreamTabPanel() { | ||
const classes = useStyles(); | ||
const [value, setValue] = React.useState(0); | ||
|
||
const handleChange = (event, newValue) => { | ||
setValue(newValue); | ||
}; | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<TabPanel value={value} index={0}> | ||
Videos | ||
</TabPanel> | ||
<TabPanel value={value} index={1}> | ||
Chat | ||
</TabPanel> | ||
<Tabs | ||
orientation="vertical" | ||
value={value} | ||
onChange={handleChange} | ||
aria-label="Vertical tabs example" | ||
className={classes.tabs} | ||
> | ||
<Tab icon={<VideocamIcon />} {...a11yProps(0)} /> | ||
<Tab icon={<ChatIcon />} {...a11yProps(1)} /> | ||
</Tabs> | ||
</div> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import StreamTabPanel from './StreamTabPanel.jsx'; | ||
|
||
export default StreamTabPanel; |
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