index.js
852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* eslint-disable no-unused-vars */
import React from 'react';
import { Container, Text } from '@mantine/core';
import File from './File';
import Thumbnails from './Thumbnail';
const Document = ({
content,
createdDate,
filePath,
filename,
writer,
images,
}) => {
const srcs = images.map(image => JSON.parse(image).image_path);
const limit = 250;
const toggleEllipsis = (str, _limit) => ({
string: str.slice(0, _limit),
});
return (
<Container
style={{
padding: '2rem 2rem',
margin: '2rem 4rem',
border: '1px solid black',
}}
>
<File filename={filename} filepath={filePath} />
<Text color="green">경로: {filePath}</Text>
<Text>{toggleEllipsis(content, limit).string}...</Text>
<Thumbnails srcs={srcs} />
</Container>
);
};
export default Document;