Skip to content

Commit

Permalink
๐Ÿ›Fix: ActionButton ํƒ€์ž… ๊ด€๋ จ ๋นŒ๋“œ ์—๋Ÿฌ
Browse files Browse the repository at this point in the history
  • Loading branch information
shlee9999 committed Nov 21, 2024
1 parent 91dbaee commit 19329c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/Button/ActionButton.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled, { BrandColors, GrayscaleColors } from 'styled-components'
import styled, { BrandColors, GrayscaleColors, Typography } from 'styled-components'

type BgColorType =
| Extract<keyof BrandColors, 'default' | 'lighten_2'>
Expand All @@ -12,7 +12,7 @@ type ActionButtonProps = {
type ActionButtonStyles = {
padding: string
borderRadius: string
fontSize: string
fontSize: keyof Typography
}

const ACTION_BUTTON_FONT_COLORS: Record<BgColorType, keyof GrayscaleColors> = {
Expand All @@ -23,7 +23,7 @@ const ACTION_BUTTON_FONT_COLORS: Record<BgColorType, keyof GrayscaleColors> = {
gc_1: 'font_4',
} as const

const ACTION_BUTTON_STYLES: Record<string, ActionButtonStyles> = {
const ACTION_BUTTON_STYLES: Record<Exclude<ActionButtonProps['$type'], undefined>, ActionButtonStyles> = {
roundedRect: {
padding: '15.5px 24px',
borderRadius: '12px',
Expand All @@ -44,7 +44,7 @@ const ACTION_BUTTON_STYLES: Record<string, ActionButtonStyles> = {
export const ActionButton = styled.button<ActionButtonProps>`
width: 100%;
background-color: ${({ theme, $bgColor = 'default' }) =>
theme.colors.grayscale[$bgColor] || theme.colors.brand[$bgColor]};
theme.colors.grayscale[$bgColor as keyof GrayscaleColors] || theme.colors.brand[$bgColor as keyof BrandColors]};
color: ${({ theme, $bgColor = 'default' }) => theme.colors.grayscale[ACTION_BUTTON_FONT_COLORS[$bgColor]]};
padding: ${({ $type = 'capsule' }) => ACTION_BUTTON_STYLES[$type]?.padding};
border-radius: ${({ $type = 'capsule' }) => ACTION_BUTTON_STYLES[$type]?.borderRadius};
Expand Down
1 change: 1 addition & 0 deletions src/styles/styled.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare module 'styled-components' {
colors: Colors
typography: Typography
}

export type BrandColors = {
darken: string
default: string
Expand Down

0 comments on commit 19329c7

Please sign in to comment.