import PropTypes from 'prop-types'
import {Container, Grid, Typography} from '@mui/material'

import {styled} from '@mui/material/styles'

import TeksKat from './teks-kat'

const PREFIX = 'denye-teks'

const classes = {
  container: `${PREFIX}-container`
}

const Root = styled('div')(() => ({
  [`&.${classes.container}`]: {
    marginTop: '1em',
    marginBottom: '2em'
  }
}))

export default function DenyeTeks({denyeTeks}) {
  return (
    <Root className={classes.container}>
      <Container>
        {denyeTeks.length === 0 && (
          <Container sx={{marginTop: 2}} align='center'>
            <Typography sx={{fontWeight: 'bold'}} variant='h6' component='h4'>
              Aucun résultat
            </Typography>
          </Container>
        )}
        <Grid container spacing={3}>
          {denyeTeks.map(t => <TeksKat key={t.id} teks={t} />)}
        </Grid>
      </Container>
    </Root>
  )
}

DenyeTeks.propTypes = {
  denyeTeks: PropTypes.array.isRequired
}
