import Grid from '@mui/material/Grid'
import SearchList from './SearchList'
import CredentialsList from './CredentialsList'
import EditBar from './EditBar'
import { TRightIsOpen } from '../../../typescript/redux/control/types'

interface IRightBar {
  rightIsOpen: TRightIsOpen,
  chatDivRef: any | null,
}

const RightBar = ({ rightIsOpen, chatDivRef }: IRightBar) => {
  return (
    <Grid item lg={rightIsOpen ? 4 : 0}>
      {rightIsOpen === 'credentials' && <CredentialsList chatDivRef={chatDivRef} />}
      {rightIsOpen === 'search' && <SearchList chatDivRef={chatDivRef} />}
      {rightIsOpen === 'edit' && <EditBar/>}
    </Grid>
   )
}

export default RightBar