diff --git a/src/components/Accordion/Accordion.stories.tsx b/src/components/Accordion/Accordion.stories.tsx index 968ba22df..cbfb635b9 100644 --- a/src/components/Accordion/Accordion.stories.tsx +++ b/src/components/Accordion/Accordion.stories.tsx @@ -1,9 +1,13 @@ import React from 'react'; import { Stories } from '@storybook/addon-docs'; import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { List } from '../List'; -import { IconName } from '../Icon'; import { Accordion, AccordionProps, AccordionSize, AccordionShape } from './'; +import { Button, ButtonShape, ButtonVariant } from '../Button'; +import { Badge } from '../Badge'; +import { IconName } from '../Icon'; +import Layout from '../Layout'; +import { List } from '../List'; +import { Stack } from '../Stack'; export default { title: 'Accordion', @@ -85,15 +89,27 @@ const listItems: AccordionProps[] = [ }, ]; +const buttons = [0, 1].map((i) => ({ + ariaLabel: `Button ${i}`, + disruptive: i === 0 ? false : true, + icon: i === 0 ? IconName.mdiCogOutline : IconName.mdiDeleteOutline, + variant: i === 0 ? ButtonVariant.Neutral : ButtonVariant.Secondary, +})); + const Single_Story: ComponentStory = (args) => ( ); const List_Story: ComponentStory = (args) => ; +const Custom_Story: ComponentStory = (args) => ( + +); + export const Single = Single_Story.bind({}); export const List_Vertical = List_Story.bind({}); export const List_Horizontal = List_Story.bind({}); +export const Custom = Custom_Story.bind({}); // Storybook 6.5 using Webpack >= 5.76.0 automatically alphabetizes exports, // this line ensures they are exported in the desired order. @@ -102,6 +118,7 @@ export const __namedExportsOrder = [ 'Single', 'List_Vertical', 'List_Horizontal', + 'Custom', ]; Single.args = { @@ -179,3 +196,92 @@ List_Horizontal.args = { padding: '8px', }, }; + +Custom.args = { + children: ( + <> +
+ Icons are optional for accordions. The body area in the expanded view is + like a modal or a slide-in panel. You can put any smaller components + inside to build a layout. +
+ + ), + id: 'myAccordionId', + expandButtonProps: null, + expandIconProps: { + path: IconName.mdiChevronDown, + }, + configContextProps: { + noGradientContext: false, + noThemeContext: false, + }, + theme: '', + themeContainerId: 'my-accordion-theme-container', + gradient: false, + headerProps: { + fullWidth: true, + style: { gap: '8px' }, + }, + summary: ( + + {' '} + {/* octupleStyles enables scoped Octuple BEM. */} + + +

+ Accordion Header 2 +

+
+ Supporting text +
+
+ + ( + + +
  • + +
  • + + + + + + + + 2 + + + + +
    +
    +
    + Icons are optional for accordions. The body area in the expanded view is like a modal or a slide-in panel. You can put any smaller components inside to build a layout. +
    +
    +
    + + +`; + exports[`Accordion Renders without crashing 1`] = `
    ({ itemClassNames, itemStyle, listClassNames, + listStyle, listType = 'ul', role, itemProps, @@ -251,13 +252,13 @@ export const List = ({
    {getHeader()} {listType === 'ul' && ( -
      +
        {getItems()} {!!renderAdditionalItem && getAdditionalItem()}
      )} {listType === 'ol' && ( -
        +
          {getItems()} {!!renderAdditionalItem && getAdditionalItem()}
        diff --git a/src/components/List/List.types.ts b/src/components/List/List.types.ts index a23dc91a2..c696e4597 100644 --- a/src/components/List/List.types.ts +++ b/src/components/List/List.types.ts @@ -58,6 +58,10 @@ export interface ListProps extends OcBaseProps { * Custom classes for the list. */ listClassNames?: string; + /** + * Style of the list + */ + listStyle?: React.CSSProperties; /** * The list html type. * @default ul