Files
pawol.nu/pages/index.js
T

57 lines
1.7 KiB
JavaScript
Raw Normal View History

2020-12-17 22:36:27 +01:00
import PropTypes from 'prop-types'
2022-01-22 12:31:55 +04:00
import {Container, Grid, Typography, Box} from '@mui/material'
2020-12-17 09:08:18 +01:00
2020-12-17 22:36:27 +01:00
import KatKayLa from '../components/kat-kay-la'
2020-12-15 23:46:05 +01:00
import HeadLayout from '../components/head-layout'
2021-06-14 23:30:00 +02:00
import Footer from '../components/footer'
import {jwennTeksKantite, jwennAwtisKantite} from '../lib/oki-api'
2020-12-04 20:16:24 +01:00
2020-12-18 22:01:47 +01:00
export default function Home({kantiteAwtis, kantiteTeks}) {
const kantite = [
2021-08-21 21:37:09 +02:00
{id: 1, tit: 'Tèks', soutit: 'Texte', kantite: kantiteTeks, route: '/teks'},
{id: 2, tit: 'Awtis', soutit: 'Artiste', kantite: kantiteAwtis, route: '/awtis?paj&paj=1'}
2020-12-17 22:36:27 +01:00
]
2020-12-04 20:16:24 +01:00
return (
2020-12-15 23:46:05 +01:00
<HeadLayout tab={0}>
2022-01-20 18:01:52 +04:00
<Box sx={{display: 'flex', flexDirection: 'column', minHeight: '100vh'}}>
2022-01-22 12:31:55 +04:00
<Box sx={{flexGrow: 1, marginTop: 6}}>
2022-01-20 18:01:52 +04:00
<Container align='center'>
<Typography variant='h6' component='h1'>
2022-01-22 12:31:55 +04:00
#OKi
</Typography>
<Typography variant='h6' component='h2'>
2022-01-20 18:01:52 +04:00
Organisation KA Internationale
</Typography>
</Container>
<Container style={{marginBlock: '1em'}}>
<Grid container spacing={3}>
{kantite.map(k => <KatKayLa key={k.id} tit={k.tit} soutit={k.soutit} kantite={k.kantite} route={k.route} />)}
2021-10-02 13:45:14 +02:00
</Grid>
2022-01-20 18:01:52 +04:00
</Container>
</Box>
2021-06-14 23:30:00 +02:00
<Footer />
2022-01-20 18:01:52 +04:00
</Box>
2020-12-15 23:46:05 +01:00
</HeadLayout>
2020-12-04 20:16:24 +01:00
)
}
2020-12-11 01:38:05 +01:00
2020-12-17 22:36:27 +01:00
Home.propTypes = {
2020-12-18 22:01:47 +01:00
kantiteAwtis: PropTypes.number.isRequired,
kantiteTeks: PropTypes.number.isRequired
2020-12-17 22:36:27 +01:00
}
2020-12-11 01:38:05 +01:00
export async function getServerSideProps() {
const awtisResponse = await jwennAwtisKantite()
const teksResponse = await jwennTeksKantite()
const kantiteAwtis = awtisResponse
const kantiteTeks = teksResponse
2020-12-11 01:38:05 +01:00
return {
props: {
2020-12-18 22:01:47 +01:00
kantiteAwtis,
kantiteTeks
2020-12-11 01:38:05 +01:00
}
}
}