|
1 | 1 | import { useNavigate } from 'react-router-dom';
|
2 | 2 |
|
3 |
| -import { Approve, Flex, Text } from '@duri-fe/ui'; |
| 3 | +import { Approve, Flex, Text, theme } from '@duri-fe/ui'; |
4 | 4 | import styled from '@emotion/styled';
|
5 | 5 |
|
6 |
| -export const DesignerInfo = () => { |
| 6 | +interface DesignerInfoProps { |
| 7 | + version?: 'vertical' | 'horizontal'; |
| 8 | + designerId: number | string; |
| 9 | + name: string; |
| 10 | + age: number; |
| 11 | + gender: string; |
| 12 | + experience: number; |
| 13 | + roles: string[]; |
| 14 | + imageUrl: string; |
| 15 | + padding?: string; |
| 16 | +} |
| 17 | + |
| 18 | +export const DesignerInfo = ({ |
| 19 | + version = 'vertical', |
| 20 | + designerId, |
| 21 | + name, |
| 22 | + age, |
| 23 | + gender, |
| 24 | + experience, |
| 25 | + roles, |
| 26 | + imageUrl, |
| 27 | + padding, |
| 28 | +}: DesignerInfoProps) => { |
7 | 29 | const navigate = useNavigate();
|
8 |
| - const moveToDetail = (designerId: number | string) => { |
9 |
| - navigate(`/portfolio/${designerId}`); |
| 30 | + |
| 31 | + const moveToPortfolio = () => { |
| 32 | + if (version === 'vertical') { |
| 33 | + navigate(`/portfolio/${designerId}`); |
| 34 | + } |
10 | 35 | };
|
| 36 | + |
11 | 37 | return (
|
12 |
| - <Flex direction="column" align="flex-start" onClick={() => moveToDetail(1)}> |
13 |
| - <DesignerImg |
14 |
| - src={ |
15 |
| - 'https://s3-alpha-sig.figma.com/img/06a3/855c/666ff7b8f7c18c7121369ac3b3132d84?Expires=1734307200&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4&Signature=kHnZaYFZ9lw11funsRnXLgiFg5Rwsg7mFn7dItWEmC-GWXDmtViBiw1KYXRDvjiutCH3s32c4r2kyPD10nx86gKJxZJWeJMVAfXaTRJVMlkBDHRajnbgbaQXd1s7JKwyNMZVxf64jzNBjyrhdCPZJk8npT8Ubb-OKkhsHGIq2zn9soSWjKqcmV9nsclfu6hFEnQlnUi77tBHKLROr8baKtikIlyYVqvOencSVUwSi~tU2Yq4DE3zhHyt9oVhIFwPcxAmS8M8d245IgP4Oehq2FUHEPyxExXdlVW6iZdRSas0SojaIv3ksehA3EH-8IMraM1RQGixX~iXhGZj6OPPtg__' |
16 |
| - } |
17 |
| - /> |
18 |
| - |
19 |
| - <Text>김댕댕</Text> |
20 |
| - <Flex justify="flex-start"> |
21 |
| - <Text>경력 5년</Text>,<Text>30세</Text>,<Text>남성</Text> |
22 |
| - </Flex> |
23 |
| - <Flex direction="column"> |
24 |
| - {['반려견 스타일리스트', '펫테이너'].map((item, idx) => ( |
25 |
| - <Flex key={idx} justify="flex-start"> |
26 |
| - <Text>{item}</Text> |
27 |
| - <Approve width={11} height={10} /> |
28 |
| - </Flex> |
29 |
| - ))} |
| 38 | + <Container |
| 39 | + version={version} |
| 40 | + onClick={moveToPortfolio} |
| 41 | + clickable={version === 'vertical'} |
| 42 | + direction={version === 'horizontal' ? 'row' : 'column'} |
| 43 | + align={version === 'horizontal' ? 'center' : 'flex-start'} |
| 44 | + gap={version === 'horizontal' ? 16 : 8} |
| 45 | + padding={padding} |
| 46 | + > |
| 47 | + <ImageWrapper version={version}> |
| 48 | + <DesignerImg |
| 49 | + version={version} |
| 50 | + src={imageUrl} |
| 51 | + alt={`${name}'s profile`} |
| 52 | + /> |
| 53 | + </ImageWrapper> |
| 54 | + |
| 55 | + <Flex direction="column" align="flex-start" justify="flex-start" gap={8}> |
| 56 | + <Text typo="Title3">{name}</Text> |
| 57 | + |
| 58 | + <Text |
| 59 | + typo="Caption4" |
| 60 | + colorCode={theme.palette.Gray400} |
| 61 | + >{`경력 ${experience}년, ${age}세, ${gender}`}</Text> |
| 62 | + |
| 63 | + <Flex direction="column" gap={8}> |
| 64 | + {roles.map((item, idx) => ( |
| 65 | + <Role key={idx}> |
| 66 | + <Text typo="Caption3" colorCode={theme.palette.Link}> |
| 67 | + {item} |
| 68 | + </Text> |
| 69 | + <Approve width={11} height={10} /> |
| 70 | + </Role> |
| 71 | + ))} |
| 72 | + </Flex> |
30 | 73 | </Flex>
|
31 |
| - </Flex> |
| 74 | + </Container> |
32 | 75 | );
|
33 | 76 | };
|
34 | 77 |
|
35 |
| -const DesignerImg = styled.img` |
36 |
| - display: flex; |
37 |
| - width: 160px; |
38 |
| - height: 160px; |
39 |
| - border-radius: 8px; |
| 78 | +const Container = styled(Flex)<{ |
| 79 | + version: 'vertical' | 'horizontal'; |
| 80 | + clickable: boolean; |
| 81 | +}>` |
| 82 | + cursor: ${({ clickable }) => (clickable ? 'pointer' : 'default')}; |
| 83 | +`; |
| 84 | + |
| 85 | +const DesignerImg = styled.img<{ version: 'vertical' | 'horizontal' }>` |
| 86 | + width: ${({ version }) => (version === 'horizontal' ? '124px' : '160px')}; |
| 87 | + height: ${({ version }) => (version === 'horizontal' ? '124px' : '160px')}; |
| 88 | + border-radius: ${({ version }) => |
| 89 | + version === 'horizontal' ? '99px' : '8px'}; |
40 | 90 | object-fit: cover;
|
41 | 91 | `;
|
| 92 | + |
| 93 | +const ImageWrapper = styled.div<{ version: 'vertical' | 'horizontal' }>` |
| 94 | + display: flex; |
| 95 | + align-items: center; |
| 96 | + justify-content: center; |
| 97 | + flex-shrink: 0; |
| 98 | +`; |
| 99 | + |
| 100 | +// 역할 태그 스타일 |
| 101 | +const Role = styled(Flex)` |
| 102 | + justify-content: flex-start; |
| 103 | + align-items: center; |
| 104 | + gap: 8px; |
| 105 | +`; |
0 commit comments