Add Edit component to Titre & Article
This commit is contained in:
@@ -1,15 +1,19 @@
|
||||
import PropTypes from 'prop-types'
|
||||
import Box from '@mui/material/Box'
|
||||
import Typography from '@mui/material/Typography'
|
||||
import Edit from './edit.js'
|
||||
|
||||
export default function Article({numero, contenu}) {
|
||||
export default function Article({session, articleId, numero, contenu}) {
|
||||
const formattedContent = contenu.replaceAll('\n', '<br />')
|
||||
|
||||
return (
|
||||
<Box textAlign='justify' p={0.5}>
|
||||
{numero > 0 && (
|
||||
<Typography marginBlock={1} fontWeight='bold'>Article {numero}</Typography>
|
||||
)}
|
||||
<Box sx={{display: 'flex', alignItems: 'center'}}>
|
||||
<Typography marginBlock={1} fontWeight='bold'>{numero === 0 ? 'Article 1' : `Article ${numero}`}</Typography>
|
||||
{session && (
|
||||
<Edit session={session} article={articleId} />
|
||||
)}
|
||||
</Box>
|
||||
|
||||
<Typography dangerouslySetInnerHTML={{__html: formattedContent}} />
|
||||
</Box>
|
||||
@@ -17,6 +21,8 @@ export default function Article({numero, contenu}) {
|
||||
}
|
||||
|
||||
Article.propTypes = {
|
||||
session: PropTypes.object,
|
||||
articleId: PropTypes.string.isRequired,
|
||||
numero: PropTypes.number,
|
||||
contenu: PropTypes.string.isRequired
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user