Include Footer and Konstitisyon components to page
This commit is contained in:
+20
-10
@@ -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 (
|
||||||
<Container maxWidth='sm'>
|
<Box sx={{
|
||||||
<Typography component='h1' textAlign='center' variant='h3'>{appTitle.toUpperCase()}</Typography>
|
display: 'flex',
|
||||||
</Container>
|
flexDirection: 'column',
|
||||||
|
minHeight: '100vh',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Container maxWidth='sm'>
|
||||||
|
<Typography mt={1} component='h1' textAlign='center' variant='h4'>{appTitle.toUpperCase()}</Typography>
|
||||||
|
<Konstitisyon titres={titres} articles={articles} />
|
||||||
|
</Container>
|
||||||
|
<Footer />
|
||||||
|
</Box>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user