Merge branch 'feat/show-detail' into 'develop'
feat: document 미리보기 기능 구현 See merge request !15
Showing
3 changed files
with
89 additions
and
4 deletions
... | @@ -16,7 +16,7 @@ | ... | @@ -16,7 +16,7 @@ |
16 | "react/prop-types": 0, | 16 | "react/prop-types": 0, |
17 | "import/prefer-default-export": 0, | 17 | "import/prefer-default-export": 0, |
18 | "no-param-reassign": 0, | 18 | "no-param-reassign": 0, |
19 | - "arrow-body-style": 0, | 19 | + "arrow-body-style": 0 |
20 | }, | 20 | }, |
21 | "settings": { | 21 | "settings": { |
22 | "react": { | 22 | "react": { | ... | ... |
frontend/src/components/Detail.js
0 → 100644
1 | +import { Card, Center, Divider, Table, Text } from '@mantine/core'; | ||
2 | +import React from 'react'; | ||
3 | + | ||
4 | +function Detail({ filename, writer, filePath, createdDate }) { | ||
5 | + const rows = ( | ||
6 | + <> | ||
7 | + <tr> | ||
8 | + <td> | ||
9 | + <Text style={{ width: 50 }} weight={700}> | ||
10 | + 문서명 | ||
11 | + </Text> | ||
12 | + </td> | ||
13 | + <td> | ||
14 | + <Text>{filename}</Text> | ||
15 | + </td> | ||
16 | + </tr> | ||
17 | + <tr> | ||
18 | + <td> | ||
19 | + <Text weight={700}>작성자</Text> | ||
20 | + </td> | ||
21 | + <td> | ||
22 | + <Text>{writer}</Text> | ||
23 | + </td> | ||
24 | + </tr> | ||
25 | + <tr> | ||
26 | + <td> | ||
27 | + <Text weight={700}>파일 경로</Text> | ||
28 | + </td> | ||
29 | + <td> | ||
30 | + <Text>{filePath}</Text> | ||
31 | + </td> | ||
32 | + </tr> | ||
33 | + <tr> | ||
34 | + <td> | ||
35 | + <Text weight={700}>파일 생성일</Text> | ||
36 | + </td> | ||
37 | + <td> | ||
38 | + <Text>{createdDate}</Text> | ||
39 | + </td> | ||
40 | + </tr> | ||
41 | + </> | ||
42 | + ); | ||
43 | + return ( | ||
44 | + <Card> | ||
45 | + <Center> | ||
46 | + <Text weight={700}>파일 정보</Text> | ||
47 | + </Center> | ||
48 | + <Divider /> | ||
49 | + <Table striped> | ||
50 | + <thead> | ||
51 | + <tbody>{rows}</tbody> | ||
52 | + </thead> | ||
53 | + </Table> | ||
54 | + </Card> | ||
55 | + ); | ||
56 | +} | ||
57 | + | ||
58 | +export default Detail; |
1 | +/* eslint-disable react/jsx-boolean-value */ | ||
1 | /* eslint-disable no-unused-vars */ | 2 | /* eslint-disable no-unused-vars */ |
2 | -import React from 'react'; | 3 | +import React, { useState } from 'react'; |
3 | -import { Container, Text } from '@mantine/core'; | 4 | +import { Container, Popover, Text } from '@mantine/core'; |
5 | +import { FaSearchPlus } from 'react-icons/fa'; | ||
4 | import File from './File'; | 6 | import File from './File'; |
5 | import Thumbnails from './Thumbnail'; | 7 | import Thumbnails from './Thumbnail'; |
8 | +import Detail from '../Detail'; | ||
6 | 9 | ||
7 | const Document = ({ | 10 | const Document = ({ |
8 | content, | 11 | content, |
... | @@ -17,6 +20,7 @@ const Document = ({ | ... | @@ -17,6 +20,7 @@ const Document = ({ |
17 | const toggleEllipsis = (str, _limit) => ({ | 20 | const toggleEllipsis = (str, _limit) => ({ |
18 | string: str.slice(0, _limit), | 21 | string: str.slice(0, _limit), |
19 | }); | 22 | }); |
23 | + const [opened, setOpened] = useState(false); | ||
20 | 24 | ||
21 | return ( | 25 | return ( |
22 | <Container | 26 | <Container |
... | @@ -26,7 +30,30 @@ const Document = ({ | ... | @@ -26,7 +30,30 @@ const Document = ({ |
26 | border: '1px solid black', | 30 | border: '1px solid black', |
27 | }} | 31 | }} |
28 | > | 32 | > |
29 | - <File filename={filename} filepath={filePath} /> | 33 | + <div style={{ display: 'flex' }}> |
34 | + <File filename={filename} filepath={filePath} /> | ||
35 | + <Popover | ||
36 | + opened={opened} | ||
37 | + onClose={() => setOpened(false)} | ||
38 | + target={ | ||
39 | + <FaSearchPlus | ||
40 | + onMouseEnter={() => setOpened(true)} | ||
41 | + onMouseLeave={() => setOpened(false)} | ||
42 | + style={{ marginTop: 3, marginLeft: 3, color: '#868e96' }} | ||
43 | + /> | ||
44 | + } | ||
45 | + position="bottom-start" | ||
46 | + gutter={50} | ||
47 | + bodyStyle={{ pointerEvents: 'none' }} | ||
48 | + > | ||
49 | + <Detail | ||
50 | + filename={filename} | ||
51 | + filePath={filePath} | ||
52 | + writer={writer} | ||
53 | + createdDate={createdDate} | ||
54 | + /> | ||
55 | + </Popover> | ||
56 | + </div> | ||
30 | <Text color="green">경로: {filePath}</Text> | 57 | <Text color="green">경로: {filePath}</Text> |
31 | <Text>{toggleEllipsis(content, limit).string}...</Text> | 58 | <Text>{toggleEllipsis(content, limit).string}...</Text> |
32 | <Thumbnails srcs={srcs} /> | 59 | <Thumbnails srcs={srcs} /> | ... | ... |
-
Please register or login to post a comment