Add KatKayLa & change index
This commit is contained in:
+59
-9
@@ -1,21 +1,66 @@
|
|||||||
import {useState} from 'react'
|
import {useState} from 'react'
|
||||||
import {Button, useMediaQuery} from '@material-ui/core'
|
import PropTypes from 'prop-types'
|
||||||
|
import Image from 'next/image'
|
||||||
|
import {Button, Container, Grid, Typography, useMediaQuery, Link} from '@material-ui/core'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
import TouchAppIcon from '@material-ui/icons/TouchApp'
|
||||||
|
|
||||||
|
import KatKayLa from '../components/kat-kay-la'
|
||||||
import HeadLayout from '../components/head-layout'
|
import HeadLayout from '../components/head-layout'
|
||||||
import Carousel from '../components/carousel'
|
import Carousel from '../components/carousel'
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home({konbyenAwtis, konbyenTeks}) {
|
||||||
const [handleOpen, setHandleOpen] = useState(false)
|
const [handleOpen, setHandleOpen] = useState(false)
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
setHandleOpen(true)
|
setHandleOpen(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const kombyen = [
|
||||||
|
{id: 1, tit: 'Konbyen Awtis', kombyen: konbyenAwtis, route: '/awtis?paj&paj=1'},
|
||||||
|
{id: 2, tit: 'Konbyen Tèks', kombyen: konbyenTeks, route: '/teks'}
|
||||||
|
]
|
||||||
|
|
||||||
const matches = useMediaQuery('(max-width:600px)')
|
const matches = useMediaQuery('(max-width:600px)')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HeadLayout tab={0}>
|
<HeadLayout tab={0}>
|
||||||
<Button onClick={handleClick}>Open carousel</Button>
|
<Container align='center'>
|
||||||
|
<Image
|
||||||
|
alt='Logo #OKi'
|
||||||
|
width={400}
|
||||||
|
height={215}
|
||||||
|
src='/logo.png'
|
||||||
|
/>
|
||||||
|
<Typography variant='h3'>
|
||||||
|
Organisation KA Internationale
|
||||||
|
</Typography>
|
||||||
|
<Typography variant='h4' component='h2' color='textSecondary'>
|
||||||
|
Transcriptions et traductions
|
||||||
|
</Typography>
|
||||||
|
<Typography variant='h5' component='h2'>
|
||||||
|
<Link href='mailto:kontak@o-k-i.net'>
|
||||||
|
kontak@o-k-i.net
|
||||||
|
</Link>
|
||||||
|
</Typography>
|
||||||
|
</Container>
|
||||||
|
<Container style={{marginTop: '5em'}}>
|
||||||
|
<Grid container spacing={3}>
|
||||||
|
{kombyen.map(k => <KatKayLa key={k.id} tit={k.tit} kombyen={k.kombyen} route={k.route} />)}
|
||||||
|
</Grid>
|
||||||
|
</Container>
|
||||||
|
<Container style={{marginTop: '5em', marginBottom: '5em'}} align='center'>
|
||||||
|
<Button
|
||||||
|
startIcon={<TouchAppIcon size='large' style={{fontSize: 50}} />}
|
||||||
|
size='large'
|
||||||
|
variant='contained'
|
||||||
|
color='primary'
|
||||||
|
onClick={handleClick}
|
||||||
|
>
|
||||||
|
<Typography style={{fontSize: '2em'}} variant='subtitle1' component='span'>
|
||||||
|
Guide
|
||||||
|
</Typography>
|
||||||
|
</Button>
|
||||||
|
</Container>
|
||||||
<Carousel
|
<Carousel
|
||||||
isMobile={matches}
|
isMobile={matches}
|
||||||
handleOpen={handleOpen}
|
handleOpen={handleOpen}
|
||||||
@@ -25,16 +70,21 @@ export default function Home() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Home.propTypes = {
|
||||||
|
konbyenAwtis: PropTypes.number.isRequired,
|
||||||
|
konbyenTeks: PropTypes.number.isRequired
|
||||||
|
}
|
||||||
|
|
||||||
export async function getServerSideProps() {
|
export async function getServerSideProps() {
|
||||||
const mizikResponse = await axios.get(`${process.env.API_URL}/mizik`)
|
const awtisResponse = await axios.get(`${process.env.API_URL}/awtis/count`)
|
||||||
const awtisResponse = await axios.get(`${process.env.API_URL}/awtis`)
|
const mizikResponse = await axios.get(`${process.env.API_URL}/mizik/count`)
|
||||||
const mizik = mizikResponse.data
|
const konbyenAwtis = awtisResponse.data
|
||||||
const awtis = awtisResponse.data
|
const konbyenTeks = mizikResponse.data
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
mizik,
|
konbyenAwtis,
|
||||||
awtis
|
konbyenTeks
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user