|
| 1 | +import { useNavigate } from 'react-router-dom' |
| 2 | + |
| 3 | +import styled from 'styled-components' |
| 4 | + |
| 5 | +import { useDevice, type DeviceType } from '@shared/hooks/useDevice' |
| 6 | +import { Button, Header, SvgButton } from '@shared/ui' |
| 7 | + |
| 8 | +import { LeftArrow } from '@/assets/icons' |
| 9 | + |
| 10 | +const Customize = () => { |
| 11 | + const navigate = useNavigate() |
| 12 | + const deviceType = useDevice() |
| 13 | + |
| 14 | + return ( |
| 15 | + <CustomizeWrap> |
| 16 | + <Header |
| 17 | + left={<SvgButton icon={LeftArrow} width={24} height={24} onClick={() => navigate(-1)} />} |
| 18 | + right={ |
| 19 | + <Button state="primary" size="S" onClick={() => navigate(-1)}> |
| 20 | + 저장 |
| 21 | + </Button> |
| 22 | + } |
| 23 | + /> |
| 24 | + <CdBase $deviceType={deviceType} /> |
| 25 | + <ThemeContainer> |
| 26 | + <ThemeTabs> |
| 27 | + <ThemeTab $isActive>테마</ThemeTab> |
| 28 | + <ThemeTab $isActive={false}>테마</ThemeTab> |
| 29 | + <ThemeTab $isActive={false}>테마</ThemeTab> |
| 30 | + <ThemeTab $isActive={false}>테마</ThemeTab> |
| 31 | + <ThemeTab $isActive={false}>테마</ThemeTab> |
| 32 | + <ThemeTab $isActive={false}>테마</ThemeTab> |
| 33 | + </ThemeTabs> |
| 34 | + |
| 35 | + <ThemeGrid> |
| 36 | + <AddThemeButton> |
| 37 | + <span>+</span> |
| 38 | + </AddThemeButton> |
| 39 | + <ThemeItem /> |
| 40 | + <ThemeItem /> |
| 41 | + <ThemeItem /> |
| 42 | + <ThemeItem /> |
| 43 | + <ThemeItem /> |
| 44 | + <ThemeItem /> |
| 45 | + <ThemeItem /> |
| 46 | + </ThemeGrid> |
| 47 | + </ThemeContainer> |
| 48 | + </CustomizeWrap> |
| 49 | + ) |
| 50 | +} |
| 51 | + |
| 52 | +export default Customize |
| 53 | + |
| 54 | +const CustomizeWrap = styled.div` |
| 55 | + width: 100%; |
| 56 | + height: 100dvh; |
| 57 | + display: flex; |
| 58 | + flex-direction: column; |
| 59 | +` |
| 60 | + |
| 61 | +const CdBase = styled.div<{ $deviceType: DeviceType }>` |
| 62 | + margin: 35px auto; |
| 63 | + width: ${({ $deviceType }) => |
| 64 | + $deviceType === 'mobile' ? 'clamp(280px, 300px, 335px)' : '335px'}; |
| 65 | + height: ${({ $deviceType }) => |
| 66 | + $deviceType === 'mobile' ? 'clamp(280px, 300px, 335px)' : '335px'}; |
| 67 | + border-radius: 50%; |
| 68 | + background: ${({ theme }) => theme.GRADIENT.hologram}; |
| 69 | +` |
| 70 | + |
| 71 | +const ThemeContainer = styled.div` |
| 72 | + margin: 0 -20px; |
| 73 | + width: calc(100% + 40px); |
| 74 | + flex: 1; |
| 75 | + border-radius: 12px 12px 0 0; |
| 76 | + background-color: ${({ theme }) => theme.COLOR['gray-700']}; |
| 77 | + overflow-y: auto; |
| 78 | + padding: 20px; |
| 79 | +` |
| 80 | + |
| 81 | +const ThemeTabs = styled.div` |
| 82 | + display: flex; |
| 83 | + gap: 8px; |
| 84 | + margin-bottom: 20px; |
| 85 | + overflow-x: auto; |
| 86 | +` |
| 87 | + |
| 88 | +const ThemeTab = styled.button<{ $isActive: boolean }>` |
| 89 | + padding: 8px 16px; |
| 90 | + border-radius: 20px; |
| 91 | + background-color: ${({ $isActive, theme }) => |
| 92 | + $isActive ? theme.COLOR['gray-600'] : 'transparent'}; |
| 93 | + color: ${({ $isActive, theme }) => |
| 94 | + $isActive ? theme.COLOR['primary-normal'] : theme.COLOR['gray-300']}; |
| 95 | + white-space: nowrap; |
| 96 | + border: none; |
| 97 | +` |
| 98 | + |
| 99 | +const ThemeGrid = styled.div` |
| 100 | + display: grid; |
| 101 | + grid-template-columns: repeat(4, 1fr); |
| 102 | + gap: 12px; |
| 103 | + margin-bottom: 20px; |
| 104 | +` |
| 105 | + |
| 106 | +const AddThemeButton = styled.button` |
| 107 | + width: 100%; |
| 108 | + aspect-ratio: 1/1; |
| 109 | + border-radius: 8px; |
| 110 | + background-color: ${({ theme }) => theme.COLOR['gray-600']}; |
| 111 | + border: none; |
| 112 | + display: flex; |
| 113 | + align-items: center; |
| 114 | + justify-content: center; |
| 115 | +
|
| 116 | + span { |
| 117 | + font-size: 24px; |
| 118 | + color: ${({ theme }) => theme.COLOR['gray-400']}; |
| 119 | + } |
| 120 | +` |
| 121 | + |
| 122 | +const ThemeItem = styled.div` |
| 123 | + width: 100%; |
| 124 | + aspect-ratio: 1/1; |
| 125 | + border-radius: 8px; |
| 126 | + background-color: ${({ theme }) => theme.COLOR['gray-800']}; |
| 127 | +` |
0 commit comments