Skip to content

Commit 45db168

Browse files
committed
♻️ Refactor: 스타일 컴포넌트 prop 앞에 '$' 표기
1 parent 7b8710c commit 45db168

File tree

11 files changed

+34
-35
lines changed

11 files changed

+34
-35
lines changed

src/components/GenderSelectButton/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ interface GenderSelectButtonProps {
1111

1212
export default function GenderSelectButton({ gender, isActive, onClick }: GenderSelectButtonProps) {
1313
return (
14-
<S.GenderBtn isActive={isActive} onClick={onClick}>
15-
<S.GenderIcon isActive={isActive} src={gender === 'male' ? Male : Female} alt='성별' />
14+
<S.GenderBtn $isActive={isActive} onClick={onClick}>
15+
<S.GenderIcon $isActive={isActive} src={gender === 'male' ? Male : Female} alt='성별' />
1616
<Typo17 weight={isActive ? '700' : '400'}>{gender === 'male' ? '남' : '여'}</Typo17>
1717
</S.GenderBtn>
1818
)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { styled } from 'styled-components'
2-
export const GenderBtn = styled.button<{ isActive: boolean }>`
3-
border: solid 2px ${({ isActive, theme }) => (isActive ? theme.colors.brand.darken : theme.colors.grayscale.gc_1)};
2+
export const GenderBtn = styled.button<{ $isActive: boolean }>`
3+
border: solid 2px ${({ $isActive, theme }) => ($isActive ? theme.colors.brand.darken : theme.colors.grayscale.gc_1)};
44
border-radius: 8px;
55
width: auto;
66
height: 102px;
7-
color: ${({ isActive, theme }) => (isActive ? theme.colors.brand.darken : theme.colors.grayscale.font_3)};
7+
color: ${({ $isActive, theme }) => ($isActive ? theme.colors.brand.darken : theme.colors.grayscale.font_3)};
88
99
display: flex;
1010
flex-direction: column;
@@ -13,9 +13,9 @@ export const GenderBtn = styled.button<{ isActive: boolean }>`
1313
gap: 0.2rem;
1414
`
1515

16-
export const GenderIcon = styled.img<{ isActive: boolean }>`
16+
export const GenderIcon = styled.img<{ $isActive: boolean }>`
1717
filter: ${props =>
18-
props.isActive
18+
props.$isActive
1919
? 'invert(12%) sepia(70%) saturate(924%) hue-rotate(351deg) brightness(96%) contrast(97%)'
2020
: 'invert(31%) sepia(4%) saturate(61%) hue-rotate(332deg) brightness(99%) contrast(97%)'};
2121
`

src/components/Toast/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// components/Toast/index.tsx
21
import * as S from './styles'
32
import { useEffect } from 'react'
43
import { useToastStore } from '~/stores/toastStore'
@@ -16,7 +15,7 @@ export default function Toast() {
1615
}, [isVisible])
1716

1817
return (
19-
<S.ToastWrapper isVisible={isVisible}>
18+
<S.ToastWrapper $isVisible={isVisible}>
2019
<S.Toast>{content}</S.Toast>
2120
</S.ToastWrapper>
2221
)

src/components/Toast/styles.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { styled } from 'styled-components'
22

3-
export const ToastWrapper = styled.div<{ isVisible: boolean }>`
3+
export const ToastWrapper = styled.div<{ $isVisible: boolean }>`
44
position: absolute;
55
top: -50px;
66
77
width: 100%;
88
display: flex;
99
justify-content: center;
1010
11-
visibility: ${({ isVisible }) => (isVisible ? 'visiblie' : 'hidden')};
12-
opacity: ${({ isVisible }) => (isVisible ? 1 : 0)};
11+
visibility: ${({ $isVisible }) => ($isVisible ? 'visiblie' : 'hidden')};
12+
opacity: ${({ $isVisible }) => ($isVisible ? 1 : 0)};
1313
transition:
1414
opacity 0.3s ease,
1515
visibility 0.3s ease;

src/modals/DatePickerModal/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default function DatePickerModal({ date, setDate }: DatePickerModalProps)
4040

4141
return (
4242
<S.ModalOverlay onClick={close}>
43-
<S.DatePickerModal isExiting={isExiting} onClick={handleModalClick}>
43+
<S.DatePickerModal $isExiting={isExiting} onClick={handleModalClick}>
4444
<S.ConfirmBtn onClick={handleConfirmBtn}>확인</S.ConfirmBtn>
4545
<S.Divider />
4646
<DatePicker

src/modals/DatePickerModal/styles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ export const ModalOverlay = styled.div`
3030
align-items: flex-end;
3131
`
3232

33-
export const DatePickerModal = styled.div<{ isExiting: boolean }>`
33+
export const DatePickerModal = styled.div<{ $isExiting: boolean }>`
3434
background-color: white;
3535
width: 100%;
3636
37-
animation: ${({ isExiting }) => (isExiting ? slideDown : slideUp)} 0.3s ease-out;
37+
animation: ${({ $isExiting }) => ($isExiting ? slideDown : slideUp)} 0.3s ease-out;
3838
3939
> div {
4040
padding: 1rem;

src/modals/RegisterDogModal/DogProfileDetailSection/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ export default function DogProfileDetailSection() {
8585
/>
8686
</S.GenderSelectBtnWrapper>
8787
<S.CheckboxWrapper onClick={() => setDogProfile({ isNeutered: !dogProfile.isNeutered })}>
88-
<S.CheckboxCircle isChecked={dogProfile.isNeutered}>
88+
<S.CheckboxCircle $isChecked={dogProfile.isNeutered}>
8989
{dogProfile.isNeutered && <img src={Check} alt='check'></img>}
9090
</S.CheckboxCircle>
91-
<S.CheckboxLabel isChecked={dogProfile.isNeutered}>중성화 했어요</S.CheckboxLabel>
91+
<S.CheckboxLabel $isChecked={dogProfile.isNeutered}>중성화 했어요</S.CheckboxLabel>
9292
</S.CheckboxWrapper>
9393
</S.GenderBtnArea>
9494
<S.InputArea>
95-
<S.PickerBtn onClick={() => pushModal(<SearchModal />)} hasBreed={!!dogProfile.breed}>
95+
<S.PickerBtn onClick={() => pushModal(<SearchModal />)} $hasBreed={!!dogProfile.breed}>
9696
{dogProfile.breed || '견종 입력'}
9797
</S.PickerBtn>
9898
<S.WeightInput
@@ -102,7 +102,7 @@ export default function DogProfileDetailSection() {
102102
onChange={onChangeWeightInput}
103103
onFocus={handleFocus}
104104
onBlur={handleBlur}
105-
hasWeight={!!dogProfile.weight}
105+
$hasWeight={!!dogProfile.weight}
106106
/>
107107
</S.InputArea>
108108
<S.ToastWrapper>

src/modals/RegisterDogModal/DogProfileDetailSection/styles.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ export const CheckboxWrapper = styled.div`
4848
gap: 0.5rem;
4949
`
5050

51-
export const CheckboxCircle = styled.div<{ isChecked: boolean }>`
51+
export const CheckboxCircle = styled.div<{ $isChecked: boolean }>`
5252
width: 24px;
5353
height: 24px;
54-
border: 2px solid ${({ isChecked }) => (isChecked ? '#000' : '#ccc')};
54+
border: 2px solid ${({ $isChecked }) => ($isChecked ? '#000' : '#ccc')};
5555
border-radius: 50%;
5656
5757
display: flex;
@@ -60,8 +60,8 @@ export const CheckboxCircle = styled.div<{ isChecked: boolean }>`
6060
cursor: pointer;
6161
`
6262

63-
export const CheckboxLabel = styled.span<{ isChecked: boolean }>`
64-
color: ${({ isChecked }) => (isChecked ? '#000' : '#ccc')};
63+
export const CheckboxLabel = styled.span<{ $isChecked: boolean }>`
64+
color: ${({ $isChecked }) => ($isChecked ? '#000' : '#ccc')};
6565
`
6666

6767
export const InputArea = styled.div`
@@ -74,25 +74,25 @@ export const InputArea = styled.div`
7474
}
7575
`
7676

77-
export const PickerBtn = styled.div<{ hasBreed: boolean }>`
77+
export const PickerBtn = styled.div<{ $hasBreed: boolean }>`
7878
width: 100%;
7979
border: none;
8080
text-align: center;
8181
padding: 17px 32px;
8282
font-size: ${({ theme }) => theme.typography._20};
83-
color: ${({ theme, hasBreed }) => (hasBreed ? 'black' : theme.colors.grayscale.font_3)};
84-
font-weight: ${({ hasBreed }) => (hasBreed ? 'bold' : 'default')};
83+
color: ${({ theme, $hasBreed }) => ($hasBreed ? 'black' : theme.colors.grayscale.font_3)};
84+
font-weight: ${({ $hasBreed }) => ($hasBreed ? 'bold' : 'default')};
8585
cursor: pointer;
8686
`
8787

88-
export const WeightInput = styled.input<{ hasWeight: boolean }>`
88+
export const WeightInput = styled.input<{ $hasWeight: boolean }>`
8989
width: 100%;
9090
border: none;
9191
text-align: center;
9292
padding: 17px 32px;
9393
border-radius: 12px;
9494
font-size: ${({ theme }) => theme.typography._20};
95-
font-weight: ${({ hasWeight }) => (hasWeight ? 'bold' : 'default')};
95+
font-weight: ${({ $hasWeight }) => ($hasWeight ? 'bold' : 'default')};
9696
&:focus {
9797
box-shadow: ${({ theme }) => `inset 0 0 0 1px ${theme.colors.grayscale.font_1}`};
9898
}

src/modals/RegisterDogModal/DogProfileSection/DogImageUploader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default function DogImageUploader({ image, setImage }: DogImageUploaderPr
2727
<img src={AddDogPicture} alt='반려견 사진 추가' />
2828
<div>반려견 사진 추가</div>
2929
<HiddenFileInput type='file' ref={fileInputRef} onChange={handleImageChange} />
30-
{image && <DogImage src={image} alt='반려견 사진' hasImage />}
30+
{image && <DogImage src={image} alt='반려견 사진' $hasImage />}
3131
</AddDogPictureBtn>
3232
</AddDogPictureBtnWrapper>
3333
)

src/modals/RegisterDogModal/DogProfileSection/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export default function DogProfileSection() {
6161
value={dogProfile.name}
6262
onChange={e => setDogProfile({ name: e.target.value })}
6363
/>
64-
<S.DatePickerBtn onClick={handleDatePickerOpen} hasBirth={!!dogProfile.birth}>
64+
<S.DatePickerBtn onClick={handleDatePickerOpen} $hasBirth={!!dogProfile.birth}>
6565
{dogProfile.birth || '생년월일 선택'}
6666
</S.DatePickerBtn>
6767
<TwoLineInput

0 commit comments

Comments
 (0)