Files
pawol.nu/pages/index.js
T

132 lines
4.2 KiB
JavaScript
Raw Normal View History

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'
2021-05-06 20:28:44 +02:00
import OndemandVideoIcon from '@material-ui/icons/OndemandVideo'
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'
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 = [
2021-05-28 17:17:25 +02:00
{id: 1, tit: 'Kantité Tèks', kantite: kantiteTeks, route: '/teks'},
{id: 2, tit: 'Kantité Awtis', kantite: kantiteAwtis, route: '/awtis?paj&paj=1'}
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'
2021-06-05 21:18:16 +02:00
width={192}
height={110}
src='/logo-192x110.png'
2020-12-17 22:36:27 +01:00
/>
2021-05-06 20:27:53 +02:00
<Typography variant='h6' component='h1'>
2020-12-17 22:36:27 +01:00
Organisation KA Internationale
</Typography>
</Container>
2021-05-28 17:17:25 +02:00
<Container style={{marginTop: '1.5em'}}>
<Grid container spacing={3}>
{kantite.map(k => <KatKayLa key={k.id} tit={k.tit} kantite={k.kantite} route={k.route} />)}
</Grid>
</Container>
2021-05-02 14:30:07 +02:00
<Container style={{marginTop: '1.5em'}} align='center'>
2021-05-06 20:28:44 +02:00
<Grid container spacing={2}>
<Grid item xs={12} md={3}>
2021-05-29 12:47:45 +02:00
<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 item xs={12} md={3}>
<Link href='https://pale.o-k-i.net'>
2021-05-06 20:28:44 +02:00
<Button
2021-05-29 12:47:45 +02:00
startIcon={<ChatIcon size='large' style={{fontSize: 40}} />}
2021-05-06 20:28:44 +02:00
size='small'
variant='contained'
color='primary'
>
<Typography style={{fontSize: '2em'}} variant='subtitle1' component='span'>
2021-05-29 12:47:45 +02:00
Palé
2021-05-06 20:28:44 +02:00
</Typography>
</Button>
</Link>
</Grid>
<Grid item xs={12} md={3}>
2021-05-29 12:47:45 +02:00
<Link href='https://gade.o-k-i.net'>
2021-05-02 14:30:07 +02:00
<Button
2021-05-29 12:47:45 +02:00
startIcon={<OndemandVideoIcon size='large' style={{fontSize: 40}} />}
2021-05-02 14:30:07 +02:00
size='small'
variant='contained'
color='primary'
>
<Typography style={{fontSize: '2em'}} variant='subtitle1' component='span'>
2021-05-29 12:47:45 +02:00
Gadé
2021-05-02 14:30:07 +02:00
</Typography>
</Button>
</Link>
</Grid>
2021-05-06 20:28:44 +02:00
<Grid item xs={12} md={3}>
2021-05-29 12:47:45 +02:00
<Link href='https://www.helloasso.com/associations/organisation-ka-internationale/adhesions/adhesion-oki'>
2021-05-02 14:30:07 +02:00
<Button
2021-05-29 12:47:45 +02:00
startIcon={<GroupAddIcon size='large' style={{fontSize: 40}} />}
2021-05-02 14:30:07 +02:00
size='small'
variant='contained'
color='primary'
>
<Typography style={{fontSize: '2em'}} variant='subtitle1' component='span'>
2021-05-29 12:47:45 +02:00
Adhérer
2021-05-02 14:30:07 +02:00
</Typography>
</Button>
</Link>
</Grid>
</Grid>
2020-12-17 22:36:27 +01:00
</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() {
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
}
}
}