Showing
3 changed files
with
48 additions
and
15 deletions
1 | import React from 'react'; | 1 | import React from 'react'; |
2 | +import { Anchor } from '@mantine/core'; | ||
2 | import { HiOutlineDocumentDownload } from 'react-icons/hi'; | 3 | import { HiOutlineDocumentDownload } from 'react-icons/hi'; |
3 | import palette from '../../lib/styles/palette'; | 4 | import palette from '../../lib/styles/palette'; |
4 | 5 | ||
5 | const File = ({ filename, filepath }) => { | 6 | const File = ({ filename, filepath }) => { |
6 | return ( | 7 | return ( |
7 | - <a style={{ color: palette.blue6 }} href={filepath}> | 8 | + <Anchor style={{ color: palette.blue7 }} href={filepath} size="lg"> |
8 | {filename} | 9 | {filename} |
9 | <HiOutlineDocumentDownload /> | 10 | <HiOutlineDocumentDownload /> |
10 | - </a> | 11 | + </Anchor> |
11 | ); | 12 | ); |
12 | }; | 13 | }; |
13 | export default File; | 14 | export default File; | ... | ... |
1 | import { Image, Text } from '@mantine/core'; | 1 | import { Image, Text } from '@mantine/core'; |
2 | -import React from 'react'; | 2 | +import React, { useState, useEffect } from 'react'; |
3 | import styled from 'styled-components'; | 3 | import styled from 'styled-components'; |
4 | +import palette from '../../lib/styles/palette'; | ||
4 | 5 | ||
6 | +const ImageContainer = styled.div` | ||
7 | + padding: 10px; | ||
8 | + border: 2px solid ${palette.gray3}; | ||
9 | + display: inline-flex; | ||
10 | +`; | ||
5 | const ImageWrapper = styled.div` | 11 | const ImageWrapper = styled.div` |
6 | - display: flex; | 12 | + box-shadow: 2px 1px 7px 1px rgba(0, 0, 0, 0.4); |
13 | + margin: 10px; | ||
14 | + border-radius: 10px; | ||
7 | `; | 15 | `; |
8 | const Thumbnails = ({ srcs }) => { | 16 | const Thumbnails = ({ srcs }) => { |
17 | + const [lists, setLists] = useState([]); | ||
18 | + const placeholder = () => { | ||
19 | + if (srcs.length <= 4) { | ||
20 | + const list = []; | ||
21 | + const tempImgList = 4 - srcs.length; | ||
22 | + for (let i = 0; i < tempImgList; i += 1) { | ||
23 | + list.push( | ||
24 | + <ImageWrapper> | ||
25 | + <Image width={200} height={250} radius="md" withPlaceholder /> | ||
26 | + </ImageWrapper> | ||
27 | + ); | ||
28 | + } | ||
29 | + setLists(list); | ||
30 | + } | ||
31 | + }; | ||
32 | + useEffect(() => { | ||
33 | + placeholder(); | ||
34 | + }, []); | ||
9 | return ( | 35 | return ( |
10 | <> | 36 | <> |
11 | - <Text style={{ marginTop: '1rem' }}>문서 내 이미지</Text> | 37 | + <Text style={{ marginTop: '1rem' }} size="lg" weight={500}> |
12 | - <ImageWrapper> | 38 | + 문서 내 이미지 |
39 | + </Text> | ||
40 | + <ImageContainer> | ||
13 | {srcs.map(src => ( | 41 | {srcs.map(src => ( |
14 | - <Image | 42 | + <ImageWrapper> |
15 | - width={200} | 43 | + <Image |
16 | - height={250} | 44 | + width={200} |
17 | - radius="md" | 45 | + height={250} |
18 | - src={src} | 46 | + radius="md" |
19 | - withPlaceholder | 47 | + src={src} |
20 | - /> | 48 | + withPlaceholder |
49 | + /> | ||
50 | + </ImageWrapper> | ||
21 | ))} | 51 | ))} |
22 | - </ImageWrapper> | 52 | + {lists} |
53 | + </ImageContainer> | ||
23 | </> | 54 | </> |
24 | ); | 55 | ); |
25 | }; | 56 | }; |
57 | + | ||
26 | export default Thumbnails; | 58 | export default Thumbnails; | ... | ... |
... | @@ -22,7 +22,7 @@ const Document = () => { | ... | @@ -22,7 +22,7 @@ const Document = () => { |
22 | templist.push( | 22 | templist.push( |
23 | <Container | 23 | <Container |
24 | style={{ | 24 | style={{ |
25 | - padding: '2rem 4rem', | 25 | + padding: '2rem 2rem', |
26 | margin: '2rem 4rem', | 26 | margin: '2rem 4rem', |
27 | border: '1px solid black', | 27 | border: '1px solid black', |
28 | }} | 28 | }} | ... | ... |
-
Please register or login to post a comment