diff --git a/components/konstitisyon/article.js b/components/konstitisyon/article.js new file mode 100644 index 0000000..b03995f --- /dev/null +++ b/components/konstitisyon/article.js @@ -0,0 +1,22 @@ +import PropTypes from 'prop-types' +import Box from '@mui/material/Box' +import Typography from '@mui/material/Typography' + +export default function Article({numero, contenu}) { + const formattedContent = contenu.replaceAll('\n', '
') + + return ( + + {numero > 0 && ( + Article {numero} + )} + + + + ) +} + +Article.propTypes = { + numero: PropTypes.number, + contenu: PropTypes.string.isRequired +} diff --git a/components/konstitisyon/index.js b/components/konstitisyon/index.js new file mode 100644 index 0000000..3c731da --- /dev/null +++ b/components/konstitisyon/index.js @@ -0,0 +1,28 @@ +import PropTypes from 'prop-types' +import Box from '@mui/material/Box' +import Paper from '@mui/material/Paper' +import {formatKonstitisyon} from '../../lib/format.js' +import Titre from './titre.js' +import Article from './article.js' + +export default function Konstitisyon({titres, articles}) { + const konstitisyon = formatKonstitisyon(titres, articles) + + return ( + + {konstitisyon.map(({titreId, titre, articles}) => ( + + + {articles.map(({id, numero, contenu}) => ( +
+ ))} + + ))} + + ) +} + +Konstitisyon.propTypes = { + titres: PropTypes.object.isRequired, + articles: PropTypes.object.isRequired +} diff --git a/components/konstitisyon/titre.js b/components/konstitisyon/titre.js new file mode 100644 index 0000000..a3e9fb0 --- /dev/null +++ b/components/konstitisyon/titre.js @@ -0,0 +1,15 @@ +import PropTypes from 'prop-types' +import Box from '@mui/material/Box' +import Typography from '@mui/material/Typography' + +export default function Titre({titre}) { + return ( + + {titre} + + ) +} + +Titre.propTypes = { + titre: PropTypes.string.isRequired +}