diff --git a/components/Accordion/Accordion.stories.tsx b/components/Accordion/Accordion.stories.tsx index a48dc0ff..29d2aee8 100644 --- a/components/Accordion/Accordion.stories.tsx +++ b/components/Accordion/Accordion.stories.tsx @@ -1,4 +1,4 @@ -import { MagnifyingGlassIcon } from '@radix-ui/react-icons'; +import { BookmarkIcon, MagnifyingGlassIcon } from '@radix-ui/react-icons'; import { Meta, StoryFn } from '@storybook/react'; import React, { useState } from 'react'; @@ -61,7 +61,7 @@ Large.args = { export const Collapsible: StoryFn = Template.bind({}); Collapsible.args = { type: 'single', - collapsible: true, + collapsible: 'true', }; Collapsible.argTypes = { size: { @@ -73,8 +73,7 @@ Collapsible.argTypes = { export const MultipleCollapsible: StoryFn = Template.bind({}); MultipleCollapsible.args = { type: 'multiple', - // @FIXME console warning of this props not being a boolean attribute - collapsible: true, + collapsible: 'true', }; MultipleCollapsible.argTypes = { size: { @@ -83,6 +82,30 @@ MultipleCollapsible.argTypes = { }, }; +export const DisabledAndCustomTrigger: StoryFn = (args) => ( + + + + Item1 Trigger + Item1 Content + + + + Disabled item + + + + }>Custom Icon + Item3 Content + + + +); +DisabledAndCustomTrigger.args = { + type: 'multiple', + collapsible: 'true', +}; + export const Complex: StoryFn = (args) => ( @@ -112,7 +135,7 @@ export const Complex: StoryFn = (args) => ( Complex.args = { type: 'multiple', - collapsible: true, + collapsible: 'true', }; Complex.argTypes = { size: { @@ -178,7 +201,7 @@ export const InsideModal: StoryFn = (args) => { InsideModal.args = { type: 'multiple', - collapsible: true, + collapsible: 'true', }; InsideModal.argTypes = { size: { diff --git a/components/Accordion/Accordion.tsx b/components/Accordion/Accordion.tsx index 36285feb..e9be68af 100644 --- a/components/Accordion/Accordion.tsx +++ b/components/Accordion/Accordion.tsx @@ -4,6 +4,7 @@ import { ChevronRightIcon } from '@radix-ui/react-icons'; import React from 'react'; import { CSS, keyframes, styled, VariantProps } from '../../stitches.config'; +import { Box } from '../Box'; import { elevationVariants } from '../Elevation'; const open = keyframes({ @@ -67,10 +68,12 @@ export const StyledAccordionTrigger = styled(AccordionPrimitive.Trigger, { boxShadow: 'inset 0 0 0 1px $colors$accordionActiveShadow', }, '@hover': { - '&:hover': { - cursor: 'pointer', - '&::before': { - backgroundColor: '$accordionHoverShadow', + '&:not([disabled])': { + '&:hover': { + cursor: 'pointer', + '&::before': { + backgroundColor: '$accordionHoverShadow', + }, }, }, }, @@ -139,15 +142,25 @@ export const AccordionItem = StyledAccordionItem as any; export type AccordionTriggerProps = React.ComponentProps & VariantProps & { children: React.ReactNode; + customIcon?: React.ReactNode; + noIcon?: boolean; }; export const AccordionTrigger = React.forwardRef< React.ElementRef, AccordionTriggerProps ->(({ children, ...props }, forwardedRef) => ( +>(({ children, noIcon = false, customIcon, ...props }, forwardedRef) => ( - - {children} + {!noIcon ? ( + customIcon ? ( + + {customIcon} + + ) : ( + + ) + ) : null} + {children} ));