Skip to content

Commit

Permalink
modify based off PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshatJawne committed Sep 21, 2024
1 parent 64f50bd commit c2114da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
8 changes: 4 additions & 4 deletions packages/code-studio/src/styleguide/CheckboxGroups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ export function CheckboxGroups(): JSX.Element {
<Flex direction="column">
<Text>Single Child</Text>
<CheckboxGroup aria-label="Single Child">
<Checkbox>Aaa</Checkbox>
<Checkbox value="Aaa">Aaa</Checkbox>
</CheckboxGroup>
</Flex>

<Flex direction="column">
<Text>Multiple Children</Text>
<CheckboxGroup aria-label="Multiple Children">
<Checkbox>Aaa</Checkbox>
<Checkbox>Bbb</Checkbox>
<Checkbox>Ccc</Checkbox>
<Checkbox value="Aaa">Aaa</Checkbox>
<Checkbox value="Bbb">Bbb</Checkbox>
<Checkbox value="Ccc">Ccc</Checkbox>
</CheckboxGroup>
</Flex>

Expand Down
12 changes: 3 additions & 9 deletions packages/components/src/spectrum/CheckboxGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,11 @@ export function CheckboxGroup({
}: CheckboxGroupProps): JSX.Element {
const wrappedChildren = useMemo(
() =>
ensureArray(children).map((child, index) =>
ensureArray(children).map(child =>
isElementOfType(child, Checkbox) ? (
React.cloneElement(child, {
key: `${index}-${String(child)}`,
value: `${index}-${String(child)}`,
})
child
) : (
<Checkbox
key={`${index}-${String(child)}`}
value={`${index}-${String(child)}`}
>
<Checkbox key={String(child)} value={String(child)}>
{String(child)}
</Checkbox>
)
Expand Down

0 comments on commit c2114da

Please sign in to comment.