import PropTypes from 'prop-types'

import {jwennTeks} from '../../lib/oki-api'

import TeksDrawer from '../../components/teks/teks-drawer'
import HeadLayout from '../../components/head-layout'

export default function Teks({teks}) {
  return (
    <HeadLayout title='Tèks - Paroles et Traductions' tab={1} slug='teks'>
      <TeksDrawer teks={teks} />
    </HeadLayout>
  )
}

export async function getServerSideProps() {
  const teks = await jwennTeks()

  return {
    props: {
      teks
    }
  }
}

Teks.propTypes = {
  teks: PropTypes.array.isRequired
}
