Skip to content

Commit

Permalink
fix: consider only direct parent for radio accordion's state
Browse files Browse the repository at this point in the history
  • Loading branch information
gndz07 authored Oct 27, 2023
1 parent 220e12b commit 85e17a6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions components/RadioAccordion/RadioAccordion.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
RadioAccordionTrigger,
} from './RadioAccordion';
import { Box } from '../Box';
import { AccordionContent, AccordionItem, AccordionRoot, AccordionTrigger } from '../Accordion';
import { Text } from '../Text';

export default {
title: 'Components/RadioAccordion',
Expand All @@ -33,6 +35,32 @@ export const Basic: ComponentStory<typeof RadioAccordionRoot> = (args) => (
</Box>
);

export const UnderAccordion: ComponentStory<typeof RadioAccordionRoot> = (args) => (
<AccordionRoot type="single" collapsible>
<AccordionItem value="default" css={{ boxShadow: 'none' }}>
<AccordionTrigger>
<Text>Open the accordion</Text>
</AccordionTrigger>
<AccordionContent>
<RadioAccordionRoot {...args}>
<RadioAccordionItem value="item-1">
<RadioAccordionTrigger>Item1 Trigger</RadioAccordionTrigger>
<RadioAccordionContent>Item1 Content</RadioAccordionContent>
</RadioAccordionItem>
<RadioAccordionItem value="item-2">
<RadioAccordionTrigger>Item2 Trigger</RadioAccordionTrigger>
<RadioAccordionContent>Item2 Content</RadioAccordionContent>
</RadioAccordionItem>
<RadioAccordionItem value="item-3">
<RadioAccordionTrigger>Item3 Trigger</RadioAccordionTrigger>
<RadioAccordionContent>Item3 Content</RadioAccordionContent>
</RadioAccordionItem>
</RadioAccordionRoot>
</AccordionContent>
</AccordionItem>
</AccordionRoot>
);

const Customize: ComponentStory<typeof RadioAccordionRoot> = (args) => (
<Box css={{ width: 300 }}>
<RadioAccordionRoot {...args} css={{ bc: '$red9' }}>
Expand Down
2 changes: 1 addition & 1 deletion components/RadioAccordion/RadioAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const StyledRadio = styled('div', RADIO_BASE_STYLES, {
width: 18,
height: 18,
mr: '$2',
'[data-state=open] &': {
'[data-state=open] > &': {
backgroundColor: '$radioIndicator',
},
});
Expand Down

0 comments on commit 85e17a6

Please sign in to comment.