Skip to content

Commit f815bca

Browse files
committed
[#45] ♻️ refactor checkbox input by replacing svg changes with css change
1 parent 394c5e9 commit f815bca

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

src/assets/icons/ic-check.svg

Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 3 deletions
Loading

src/components/common/input/CheckboxInput.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import {
2-
IcCheckOff,
3-
IcCheckOn,
4-
IcCheckboxOff,
5-
IcCheckboxOn,
6-
} from '@/assets/IconList'
1+
import { IcCheck, IcCheckboxOn } from '@/assets/IconList'
72
import clsx from 'clsx'
83
import { twMerge } from 'tailwind-merge'
94

@@ -26,18 +21,23 @@ export const CheckboxInput = ({
2621
...props
2722
}: CheckboxInputProps): JSX.Element => {
2823
const getCheckboxIcon = (checked: boolean) => {
29-
return checked ? (
30-
<IcCheckboxOn width={24} height={24} alt='체크된 체크박스' />
31-
) : (
32-
<IcCheckboxOff width={24} height={24} alt='체크 안 된 체크박스' />
24+
const checkBoxClass = clsx(
25+
'flex h-20 w-20 items-center justify-center rounded-3 border-[1.4px] border-solid border-gray-300',
26+
{ 'border-0 bg-primary-normal': checked }
27+
)
28+
const checkClass = 'text-common-white'
29+
return (
30+
<div className={checkBoxClass}>
31+
<IcCheckboxOn className={checkClass} alt='체크된 체크박스' />
32+
</div>
3333
)
3434
}
3535

3636
const getCheckIcon = (checked: boolean) => {
37-
return checked ? (
38-
<IcCheckOn width={24} height={24} alt='체크된 체크' />
39-
) : (
40-
<IcCheckOff width={24} height={24} alt='체크 안 된 체크' />
37+
const checkClass = clsx('text-gray-300', { 'text-primary-normal': checked })
38+
const checkAlt = checked ? '체크된 체크' : '체크 안 된 체크'
39+
return (
40+
<IcCheck width={24} height={24} className={checkClass} alt={checkAlt} />
4141
)
4242
}
4343

0 commit comments

Comments
 (0)