index.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import Grid from '@mui/material/Grid'
  2. import { makeStyles } from '@material-ui/core'
  3. import { useSelector } from 'react-redux'
  4. import { getIsOpen } from '../../../redux/control/selector'
  5. import { getChatMemo } from '../../../redux/chat/selector'
  6. import HeaderBar from './HeaderBar'
  7. import ChatBar from './ChatBar'
  8. import RightListsAndBars from './RightListsAndBars'
  9. const useStyles = makeStyles({
  10. chatBar: {
  11. background: 'linear-gradient(to bottom right, #e7f097 , #b1e667,#f4f75e)',
  12. },
  13. })
  14. const RightBar = () => {
  15. const classes = useStyles()
  16. const isOpen = useSelector(getIsOpen)
  17. const { _id } = useSelector(getChatMemo)
  18. const handleIsOpen = isOpen&&isOpen !== 'menu'
  19. return _id?
  20. <Grid item lg={9} style={{display:'flex'}}>
  21. <Grid item lg={handleIsOpen?8:12}>
  22. <Grid item lg={12} >
  23. <HeaderBar/>
  24. </Grid>
  25. <Grid item lg={12} className={classes.chatBar}>
  26. <ChatBar />
  27. </Grid>
  28. </Grid>
  29. <Grid item lg={handleIsOpen?4:0}>
  30. <RightListsAndBars/>
  31. </Grid>
  32. </Grid>
  33. : <Grid item lg={9} className={classes.chatBar}/>
  34. }
  35. export default RightBar