Files
konstitisyon.nu/components/konstitisyon/edit/article.js
T

28 lines
921 B
JavaScript
Raw Normal View History

2024-05-18 09:36:44 +04:00
import PropTypes from 'prop-types'
import Box from '@mui/material/Box'
import Typography from '@mui/material/Typography'
2025-07-23 12:21:57 +04:00
import MarkdownRenderer from '../../markdown-renderer/index.js'
2024-07-06 16:41:34 +02:00
import Edit from './index.js'
2024-05-18 09:36:44 +04:00
2024-05-20 14:48:52 +04:00
export default function Article({session, articleId, numero, contenu}) {
2024-05-18 09:36:44 +04:00
return (
<Box textAlign='justify' p={0.5}>
2024-05-20 14:48:52 +04:00
<Box sx={{display: 'flex', alignItems: 'center'}}>
2024-06-24 13:38:29 +04:00
<Typography marginBlock={1} fontWeight='bold'>{!numero || numero === 0 ? 'Article ...' : `Article ${numero}`}</Typography>
2024-05-20 14:48:52 +04:00
{session && (
2024-07-06 16:41:34 +02:00
<Edit session={session} id={articleId} contenu={contenu} collection='articles' />
2024-05-20 14:48:52 +04:00
)}
</Box>
2024-05-18 09:36:44 +04:00
2025-07-23 12:21:57 +04:00
<MarkdownRenderer content={contenu} fallbackComponent={Typography} />
2024-05-18 09:36:44 +04:00
</Box>
)
}
Article.propTypes = {
2024-05-20 14:48:52 +04:00
session: PropTypes.object,
articleId: PropTypes.string.isRequired,
2024-05-18 09:36:44 +04:00
numero: PropTypes.number,
contenu: PropTypes.string.isRequired
}