|
| 1 | +import { style, styleVariants } from '@vanilla-extract/css'; |
| 2 | + |
| 3 | +import { colors } from '@/style/token/color.css'; |
| 4 | +import { fonts } from '@/style/token/typography.css'; |
| 5 | + |
| 6 | +// ====== 공통 base 스타일 ====== |
| 7 | +const bigGoalBase = { |
| 8 | + display: 'flex', |
| 9 | + alignItems: 'center', |
| 10 | + flexShrink: 0, |
| 11 | + width: '57.1rem', |
| 12 | + height: '8rem', |
| 13 | + borderRadius: '12px', |
| 14 | + padding: '2rem 3rem', |
| 15 | + fontSize: fonts.title01.fontSize, |
| 16 | + fontWeight: fonts.title01.fontWeight, |
| 17 | + lineHeight: fonts.title01.lineHeight, |
| 18 | +}; |
| 19 | +const subGoalBase = { |
| 20 | + display: 'flex', |
| 21 | + alignItems: 'center', |
| 22 | + flexShrink: 0, |
| 23 | + width: '57.1rem', |
| 24 | + height: '5.6rem', |
| 25 | + borderRadius: '8px', |
| 26 | + padding: '1.4rem 2rem', |
| 27 | + fontSize: fonts.subtitle03.fontSize, |
| 28 | + fontWeight: fonts.subtitle03.fontWeight, |
| 29 | + lineHeight: fonts.subtitle03.lineHeight, |
| 30 | +}; |
| 31 | +const todoBase = { |
| 32 | + display: 'flex', |
| 33 | + alignItems: 'center', |
| 34 | + flexShrink: 0, |
| 35 | + width: '43.6rem', |
| 36 | + height: '5.6rem', |
| 37 | + borderRadius: '8px', |
| 38 | + padding: '1.4rem 2rem', |
| 39 | + fontSize: fonts.subtitle03.fontSize, |
| 40 | + fontWeight: fonts.subtitle03.fontWeight, |
| 41 | + lineHeight: fonts.subtitle03.lineHeight, |
| 42 | +}; |
| 43 | + |
| 44 | +export const bigGoalBaseClass = style(bigGoalBase); |
| 45 | +export const subGoalBaseClass = style(subGoalBase); |
| 46 | +export const todoBaseClass = style(todoBase); |
| 47 | + |
| 48 | +export const inputBase = style({ |
| 49 | + display: 'block', |
| 50 | + width: '100%', |
| 51 | + height: '100%', |
| 52 | + background: 'transparent', |
| 53 | + border: 'none', |
| 54 | + outline: 'none', |
| 55 | + padding: 0, |
| 56 | + color: 'inherit', |
| 57 | +}); |
| 58 | + |
| 59 | +const makeInputStyle = (font: any) => |
| 60 | + style({ |
| 61 | + fontFamily: 'Pretendard', |
| 62 | + ...font, |
| 63 | + '::placeholder': { |
| 64 | + color: colors.grey6, |
| 65 | + fontFamily: 'Pretendard', |
| 66 | + ...font, |
| 67 | + }, |
| 68 | + }); |
| 69 | +export const inputBigGoal = makeInputStyle(fonts.title01); |
| 70 | +export const inputSubGoal = makeInputStyle(fonts.subtitle03); |
| 71 | +export const inputTodo = makeInputStyle(fonts.subtitle03); |
| 72 | + |
| 73 | +export const inputVariants = styleVariants({ |
| 74 | + bigGoal: [inputBase, inputBigGoal], |
| 75 | + subGoal: [inputBase, inputSubGoal], |
| 76 | + todo: [inputBase, inputTodo], |
| 77 | +}); |
| 78 | + |
| 79 | +export const bigGoalVariants = styleVariants({ |
| 80 | + default: { |
| 81 | + ...bigGoalBase, |
| 82 | + border: '0.3rem solid transparent', |
| 83 | + background: colors.grey4, |
| 84 | + color: colors.grey6, |
| 85 | + textAlign: 'left', |
| 86 | + }, |
| 87 | + clicked: { |
| 88 | + ...bigGoalBase, |
| 89 | + border: `0.3rem solid ${colors.grey5}`, |
| 90 | + background: colors.grey3, |
| 91 | + color: colors.grey6, |
| 92 | + textAlign: 'left', |
| 93 | + }, |
| 94 | + typing: { |
| 95 | + ...bigGoalBase, |
| 96 | + border: `0.3rem solid ${colors.grey5}`, |
| 97 | + background: colors.grey3, |
| 98 | + color: colors.grey10, |
| 99 | + textAlign: 'left', |
| 100 | + justifyContent: 'space-between', |
| 101 | + }, |
| 102 | + filled: { |
| 103 | + ...bigGoalBase, |
| 104 | + border: '0.3rem solid transparent', |
| 105 | + background: colors.grey4, |
| 106 | + color: colors.grey10, |
| 107 | + textAlign: 'center', |
| 108 | + }, |
| 109 | + hover: { |
| 110 | + ...bigGoalBase, |
| 111 | + border: '0.3rem solid transparent', |
| 112 | + background: colors.grey3, |
| 113 | + color: colors.grey6, |
| 114 | + textAlign: 'center', |
| 115 | + }, |
| 116 | +}); |
| 117 | + |
| 118 | +const createVariantStyles = (baseStyle: object) => ({ |
| 119 | + default: { |
| 120 | + ...baseStyle, |
| 121 | + border: '2px solid transparent', |
| 122 | + background: colors.grey4, |
| 123 | + color: colors.grey6, |
| 124 | + textAlign: 'center' as const, |
| 125 | + }, |
| 126 | + clicked: { |
| 127 | + ...baseStyle, |
| 128 | + border: `2px solid ${colors.blue06}`, |
| 129 | + background: colors.grey3, |
| 130 | + color: colors.grey6, |
| 131 | + textAlign: 'center' as const, |
| 132 | + }, |
| 133 | + typing: { |
| 134 | + ...baseStyle, |
| 135 | + border: `2px solid ${colors.blue06}`, |
| 136 | + background: colors.grey3, |
| 137 | + color: colors.grey10, |
| 138 | + textAlign: 'left' as const, |
| 139 | + justifyContent: 'space-between' as const, |
| 140 | + }, |
| 141 | + filled: { |
| 142 | + ...baseStyle, |
| 143 | + border: '2px solid transparent', |
| 144 | + background: colors.grey4, |
| 145 | + color: colors.grey10, |
| 146 | + textAlign: 'center' as const, |
| 147 | + fontWeight: 600, |
| 148 | + }, |
| 149 | + hover: { |
| 150 | + ...baseStyle, |
| 151 | + border: '2px solid transparent', |
| 152 | + background: colors.grey3, |
| 153 | + color: colors.grey6, |
| 154 | + textAlign: 'center' as const, |
| 155 | + }, |
| 156 | +}); |
| 157 | + |
| 158 | +export const subGoalVariants = styleVariants(createVariantStyles(subGoalBase)); |
| 159 | +export const todoVariants = styleVariants(createVariantStyles(todoBase)); |
| 160 | + |
| 161 | +const CLEAR_BUTTON_SIZE = '3.2rem'; |
| 162 | +const CLEAR_BUTTON_SMALL_SIZE = '2.4rem'; |
| 163 | +export const clearButton = style({ |
| 164 | + display: 'flex', |
| 165 | + alignItems: 'center', |
| 166 | + justifyContent: 'center', |
| 167 | + width: CLEAR_BUTTON_SIZE, |
| 168 | + height: CLEAR_BUTTON_SIZE, |
| 169 | + aspectRatio: '1/1', |
| 170 | + background: 'none', |
| 171 | + border: 'none', |
| 172 | + padding: 0, |
| 173 | + cursor: 'pointer', |
| 174 | +}); |
| 175 | +export const clearButtonSmall = style({ |
| 176 | + display: 'flex', |
| 177 | + alignItems: 'center', |
| 178 | + justifyContent: 'center', |
| 179 | + width: CLEAR_BUTTON_SMALL_SIZE, |
| 180 | + height: CLEAR_BUTTON_SMALL_SIZE, |
| 181 | + background: 'none', |
| 182 | + border: 'none', |
| 183 | + padding: 0, |
| 184 | + cursor: 'pointer', |
| 185 | +}); |
0 commit comments