2020-12-17 09:08:18 +01:00
|
|
|
import {useState} from 'react'
|
2020-12-17 22:36:27 +01:00
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
|
import Image from 'next/image'
|
|
|
|
|
import {Button, Container, Grid, Typography, useMediaQuery, Link} from '@material-ui/core'
|
2021-05-02 14:30:07 +02:00
|
|
|
import HelpIcon from '@material-ui/icons/Help'
|
|
|
|
|
import ChatIcon from '@material-ui/icons/Chat'
|
|
|
|
|
import GroupAddIcon from '@material-ui/icons/GroupAdd'
|
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'
|
2020-12-17 09:08:18 +01:00
|
|
|
import Carousel from '../components/carousel'
|
2020-12-23 20:31:15 +01:00
|
|
|
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}) {
|
2020-12-17 09:08:18 +01:00
|
|
|
const [handleOpen, setHandleOpen] = useState(false)
|
|
|
|
|
const handleClick = () => {
|
|
|
|
|
setHandleOpen(true)
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-18 22:01:47 +01:00
|
|
|
const kantite = [
|
|
|
|
|
{id: 1, tit: 'Kantité Awtis', kantite: kantiteAwtis, route: '/awtis?paj&paj=1'},
|
|
|
|
|
{id: 2, tit: 'Kantité Tèks', kantite: kantiteTeks, route: '/teks'}
|
2020-12-17 22:36:27 +01:00
|
|
|
]
|
|
|
|
|
|
2020-12-17 09:08:18 +01:00
|
|
|
const matches = useMediaQuery('(max-width:600px)')
|
|
|
|
|
|
2020-12-04 20:16:24 +01:00
|
|
|
return (
|
2020-12-15 23:46:05 +01:00
|
|
|
<HeadLayout tab={0}>
|
2020-12-17 22:36:27 +01:00
|
|
|
<Container align='center'>
|
|
|
|
|
<Image
|
|
|
|
|
alt='Logo #OKi'
|
2020-12-22 23:14:54 +01:00
|
|
|
width={384}
|
|
|
|
|
height={220}
|
|
|
|
|
src='/logo-384x220.png'
|
2020-12-17 22:36:27 +01:00
|
|
|
/>
|
2021-01-10 18:45:14 +01:00
|
|
|
<Typography variant='h4' component='h1'>
|
2020-12-17 22:36:27 +01:00
|
|
|
Organisation KA Internationale
|
|
|
|
|
</Typography>
|
|
|
|
|
</Container>
|
2021-05-02 14:30:07 +02:00
|
|
|
<Container style={{marginTop: '1.5em'}} align='center'>
|
|
|
|
|
<Grid container spacing={3}>
|
|
|
|
|
<Grid item xs={12} md={4}>
|
|
|
|
|
<Link href='https://pale.o-k-i.net'>
|
|
|
|
|
<Button
|
|
|
|
|
startIcon={<ChatIcon size='large' style={{fontSize: 40}} />}
|
|
|
|
|
size='small'
|
|
|
|
|
variant='contained'
|
|
|
|
|
color='primary'
|
|
|
|
|
>
|
|
|
|
|
<Typography style={{fontSize: '2em'}} variant='subtitle1' component='span'>
|
|
|
|
|
Palé
|
|
|
|
|
</Typography>
|
|
|
|
|
</Button>
|
|
|
|
|
</Link>
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid item xs={12} md={4}>
|
|
|
|
|
<Link href='https://www.helloasso.com/associations/organisation-ka-internationale/adhesions/adhesion-oki'>
|
|
|
|
|
<Button
|
|
|
|
|
startIcon={<GroupAddIcon size='large' style={{fontSize: 40}} />}
|
|
|
|
|
size='small'
|
|
|
|
|
variant='contained'
|
|
|
|
|
color='primary'
|
|
|
|
|
>
|
|
|
|
|
<Typography style={{fontSize: '2em'}} variant='subtitle1' component='span'>
|
|
|
|
|
Adhérer
|
|
|
|
|
</Typography>
|
|
|
|
|
</Button>
|
|
|
|
|
</Link>
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid item xs={12} md={4}>
|
|
|
|
|
<Button
|
|
|
|
|
startIcon={<HelpIcon size='large' style={{fontSize: 40}} />}
|
|
|
|
|
size='small'
|
|
|
|
|
variant='contained'
|
|
|
|
|
color='primary'
|
|
|
|
|
onClick={handleClick}
|
|
|
|
|
>
|
|
|
|
|
<Typography style={{fontSize: '2em'}} variant='subtitle1' component='span'>
|
|
|
|
|
Guide
|
|
|
|
|
</Typography>
|
|
|
|
|
</Button>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
2020-12-17 22:36:27 +01:00
|
|
|
</Container>
|
2021-01-10 18:45:14 +01:00
|
|
|
<Container style={{marginTop: '3em'}}>
|
|
|
|
|
<Grid container spacing={3}>
|
|
|
|
|
{kantite.map(k => <KatKayLa key={k.id} tit={k.tit} kantite={k.kantite} route={k.route} />)}
|
|
|
|
|
</Grid>
|
|
|
|
|
</Container>
|
2020-12-17 09:08:18 +01:00
|
|
|
<Carousel
|
|
|
|
|
isMobile={matches}
|
|
|
|
|
handleOpen={handleOpen}
|
|
|
|
|
setHandleOpen={setHandleOpen}
|
|
|
|
|
/>
|
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() {
|
2020-12-23 20:31:15 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|