Include Footer and Konstitisyon components to page

This commit is contained in:
2024-05-18 09:37:09 +04:00
parent a13bc564a9
commit 2e916fed68
+18 -8
View File
@@ -1,7 +1,9 @@
import {createDirectus, rest, readItems} from '@directus/sdk' import {createDirectus, rest, readItems} from '@directus/sdk'
import Container from '@mui/material/Container' import Container from '@mui/material/Container'
import Box from '@mui/material/Box'
import Typography from '@mui/material/Typography' import Typography from '@mui/material/Typography'
import {formatKonstitisyon} from '../lib/format.js' import Konstitisyon from '../components/konstitisyon/index.js'
import Footer from '../components/footer.js'
const apiUrl = process.env.DIRECTUS_API_URL const apiUrl = process.env.DIRECTUS_API_URL
const appTitle = process.env.APP_TITLE const appTitle = process.env.APP_TITLE
@@ -30,22 +32,30 @@ async function getData() {
throw new Error('No data') throw new Error('No data')
} }
const konstitisyon = formatKonstitisyon(titres, articles) return {
titres,
return konstitisyon articles
}
} catch { } catch {
throw new Error('Failed to fetch data') throw new Error('Failed to fetch data')
} }
} }
export default async function Page() { export default async function Page() {
const data = await getData() const {titres, articles} = await getData()
console.log('data', data)
return ( return (
<Box sx={{
display: 'flex',
flexDirection: 'column',
minHeight: '100vh',
}}
>
<Container maxWidth='sm'> <Container maxWidth='sm'>
<Typography component='h1' textAlign='center' variant='h3'>{appTitle.toUpperCase()}</Typography> <Typography mt={1} component='h1' textAlign='center' variant='h4'>{appTitle.toUpperCase()}</Typography>
<Konstitisyon titres={titres} articles={articles} />
</Container> </Container>
<Footer />
</Box>
) )
} }