Skip to content

Commit f942955

Browse files
docs(SwitchCase): add 'boolean' type (#199)
Co-authored-by: seungrodotlee <seungrodotlee@gmail.com>
1 parent 147cc42 commit f942955

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/components/SwitchCase/SwitchCase.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
```ts
88
function SwitchCase(
9-
value: string | number,
10-
caseBy: Record<string | number, () => JSX.Element>,
9+
value: string | number | boolean,
10+
caseBy: Record<string | number | boolean, () => JSX.Element>,
1111
defaultComponent: () => JSX.Element
1212
): JSX.Element;
1313
```
@@ -17,14 +17,14 @@ function SwitchCase(
1717
<Interface
1818
required
1919
name="value"
20-
type="string | number"
20+
type="string | number | boolean"
2121
description="The value to compare against. The component associated with the matching key in <code>caseBy</code> will be rendered."
2222
/>
2323

2424
<Interface
2525
required
2626
name="caseBy"
27-
type="Record<string | number, () => JSX.Element>"
27+
type="Record<string | number | boolean, () => JSX.Element>"
2828
description="An object that maps values to components to render. The keys represent possible values, and the values are functions returning the corresponding components."
2929
/>
3030

src/components/SwitchCase/SwitchCase.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ type Props<Case> = {
1717
* similar to a `switch-case` statement. It is useful when you need to conditionally render different
1818
* components depending on a specific state.
1919
*
20-
* @param {string | number} value - The value to compare against.
20+
* @param {Case} value - The value to compare against.
2121
* The component associated with the matching key in `caseBy` will be rendered.
22-
* @param {Record<string | number, () => JSX.Element>} caseBy - An object that maps values to
22+
* @param {Partial<{ [P in StringifiedValue<Case>]: () => ReactElement | null }>} caseBy - An object that maps values to
2323
* components to render. The keys represent possible values, and the values are functions returning
2424
* the corresponding components.
25-
* @param {() => JSX.Element} [defaultComponent] - The component to render if `value` does not match
25+
* @param {() => ReactElement | null} [defaultComponent] - The component to render if `value` does not match
2626
* any key in `caseBy`.
2727
*
28-
* @returns {JSX.Element} A React component that conditionally renders based on cases.
28+
* @returns {ReactElement | null} A React component that conditionally renders based on cases.
2929
*
3030
* @example
3131
* function App() {

src/components/SwitchCase/ko/SwitchCase.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
```ts
88
function SwitchCase(
9-
value: string | number,
10-
caseBy: Record<string | number, () => JSX.Element>,
9+
value: string | number | boolean,
10+
caseBy: Record<string | number | boolean, () => JSX.Element>,
1111
defaultComponent: () => JSX.Element
1212
): JSX.Element;
1313
```
@@ -17,14 +17,14 @@ function SwitchCase(
1717
<Interface
1818
required
1919
name="value"
20-
type="string | number"
20+
type="string | number | boolean"
2121
description="비교할 값이에요. <code>caseBy</code>에서 일치하는 키와 연결된 컴포넌트가 렌더링돼요."
2222
/>
2323

2424
<Interface
2525
required
2626
name="caseBy"
27-
type="Record<string | number, () => JSX.Element>"
27+
type="Record<string | number | boolean, () => JSX.Element>"
2828
description="렌더링할 컴포넌트를 값으로 맵핑하는 객체예요. 키는 가능한 값을 나타내며, 값은 해당 컴포넌트를 반환하는 함수예요."
2929
/>
3030

0 commit comments

Comments
 (0)