|
|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import { Title, Text, Container, rem, createStyles, TypographyStylesProvider } from '@mantine/core';
|
|
|
|
|
import { Title, Container, rem, createStyles, TypographyStylesProvider, Image } from '@mantine/core';
|
|
|
|
|
import { Carousel } from '@mantine/carousel';
|
|
|
|
|
import { useLoaderData } from 'react-router-dom';
|
|
|
|
|
import Markdown from 'react-markdown';
|
|
|
|
|
|
|
|
|
|
@ -31,17 +32,27 @@ export function Article() {
|
|
|
|
|
const articleData = useLoaderData();
|
|
|
|
|
const { classes } = useStyles();
|
|
|
|
|
const article = articleData.data[0].attributes
|
|
|
|
|
console.log(articleData)
|
|
|
|
|
|
|
|
|
|
const generateCarousel = () => {
|
|
|
|
|
if (articleData.data[0].attributes.carousel.data) {
|
|
|
|
|
return (
|
|
|
|
|
<Carousel slideSize="70%" height={500} slideGap="md" loop>
|
|
|
|
|
{articleData.data[0].attributes.carousel.data.map(image => <Carousel.Slide><Image fit='fill' height={500} mx="auto" radius="md" src={`http://strapi.wg.gateway.ts${image.attributes.url}`} alt="Random image" /></Carousel.Slide>)}
|
|
|
|
|
</Carousel>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Container className={classes.content}>
|
|
|
|
|
<Title order={1} className={classes.title}>
|
|
|
|
|
{article.title}
|
|
|
|
|
</Title>
|
|
|
|
|
<Text>
|
|
|
|
|
<TypographyStylesProvider>
|
|
|
|
|
<Markdown>{article.content}</Markdown>
|
|
|
|
|
</TypographyStylesProvider>
|
|
|
|
|
</Text>
|
|
|
|
|
{generateCarousel()}
|
|
|
|
|
</Container>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|