Skip to content

Commit ba015cf

Browse files
committed
refactor(#38): CheckBox 컴포넌트 스타일 수정 및 JSDoc 수정
1 parent 17e3d55 commit ba015cf

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

src/components/ui/CheckBox/CheckBox.css.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,36 @@ import { semantic } from "@/styles";
55

66
export const checkboxWrapper = recipe({
77
base: {
8-
width: "24px",
9-
height: "24px",
8+
width: "2.4rem",
9+
height: "2.4rem",
1010
display: "flex",
1111
alignItems: "center",
1212
justifyContent: "center",
1313
cursor: "pointer",
1414
borderRadius: "4.8px",
15-
transition: "background-color 0.2s ease-in-out",
15+
transition: "background-color 0.2s ease-in-out, color 0.2s ease-in-out",
1616
},
1717
variants: {
1818
hasBackground: {
19-
true: { backgroundColor: semantic.icon.disabled },
20-
false: { backgroundColor: "transparent" },
19+
true: {
20+
backgroundColor: semantic.icon.disabled,
21+
},
22+
false: {
23+
backgroundColor: "transparent",
24+
},
2125
},
2226
checked: {
23-
true: { color: semantic.icon.white },
24-
false: { color: semantic.icon.white },
27+
true: {},
28+
false: {},
2529
},
2630
},
2731
compoundVariants: [
32+
{
33+
variants: { hasBackground: true, checked: false },
34+
style: {
35+
color: semantic.icon.white,
36+
},
37+
},
2838
{
2939
variants: { hasBackground: true, checked: true },
3040
style: {
@@ -47,6 +57,7 @@ export const checkboxWrapper = recipe({
4757
],
4858
defaultVariants: {
4959
hasBackground: true,
60+
checked: false,
5061
},
5162
});
5263

src/components/ui/CheckBox/CheckBox.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@ type CheckBoxProps = {
3131

3232
/**
3333
* CheckBox UI 컴포넌트
34-
*
35-
* @param {boolean} checked - 체크박스의 체크 상태
36-
* @param {boolean} [hasBackground=true] - 배경색 포함 여부
37-
* @param {function} onCheckedChange - 체크 상태 변경 콜백
38-
* @param {string} [className] - 추가 CSS 클래스
34+
* @example
35+
* ```tsx
36+
* <CheckBox
37+
* checked={checked}
38+
* onCheckedChange={setChecked}
39+
* hasBackground={true} // 기본값이 true 이므로 생략 가능
40+
* className="my-custom-class" // 추가 스타일링이 필요할 때
41+
* />
42+
* ```
3943
*/
4044
export const CheckBox = ({
4145
checked,

0 commit comments

Comments
 (0)