2020-12-17 09:08:18 +01:00
|
|
|
import {useState} from 'react'
|
|
|
|
|
import {Button, useMediaQuery} from '@material-ui/core'
|
2020-12-11 01:38:05 +01:00
|
|
|
import axios from 'axios'
|
2020-12-17 09:08:18 +01:00
|
|
|
|
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-04 20:16:24 +01:00
|
|
|
|
|
|
|
|
export default function Home() {
|
2020-12-17 09:08:18 +01:00
|
|
|
const [handleOpen, setHandleOpen] = useState(false)
|
|
|
|
|
const handleClick = () => {
|
|
|
|
|
setHandleOpen(true)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 09:08:18 +01:00
|
|
|
<Button onClick={handleClick}>Open carousel</Button>
|
|
|
|
|
<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
|
|
|
|
|
|
|
|
export async function getServerSideProps() {
|
|
|
|
|
const mizikResponse = await axios.get(`${process.env.API_URL}/mizik`)
|
|
|
|
|
const awtisResponse = await axios.get(`${process.env.API_URL}/awtis`)
|
|
|
|
|
const mizik = mizikResponse.data
|
|
|
|
|
const awtis = awtisResponse.data
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
props: {
|
|
|
|
|
mizik,
|
|
|
|
|
awtis
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|