diff --git a/packages/vanilla/src/components/segmented-button-group/segmented-button-group.stories.js b/packages/vanilla/src/components/segmented-button-group/segmented-button-group.stories.js index 9826d744..639579e8 100644 --- a/packages/vanilla/src/components/segmented-button-group/segmented-button-group.stories.js +++ b/packages/vanilla/src/components/segmented-button-group/segmented-button-group.stories.js @@ -1,32 +1,43 @@ export default { title: 'Patterns/Segmented Button Group', - argTypes: {}, + argTypes: { + selection: { + name: 'Selection', + description: 'Choose whether a single or multiple selections are allowed.', + control: 'radio', + options: ['single', 'multi'] + }, + }, }; -const SingleSelectTemplate = () => { + +function generateButtons(buttons) { + const html = buttons.map(({ label, value, selected, disabled}) => { + return `` + }) + return html.join("") +}; + + +const SingleSelectTemplate = ( {buttons, selection} ) => { return ` -
- - - +
+ ${generateButtons(buttons)}
`; }; -const MultiSelectTemplate = () => { +const MultiSelectTemplate = ({buttons, selection}) => { return ` -
- - - - +
+ ${generateButtons(buttons)}
`; }; -const IconSelectTemplate = () => { +const IconSelectTemplate = ({buttons, selection}) => { return ` -
+
@@ -40,10 +51,76 @@ const IconSelectTemplate = () => { }; export const SingleSelect = SingleSelectTemplate.bind({}); -SingleSelect.args = {}; +SingleSelect.argTypes = { + buttons: { + name: 'Buttons', + description: 'Configure various aspects of the buttons within the segmented button group.', + control: 'object' + } +} +SingleSelect.args = { + buttons: [ + { + label: "Small", + value: "sm", + selected: false, + disabled: false + }, + { + label: "Medium", + value: "md", + selected: false, + disabled: false + }, + { + label: "Large", + value: "lg", + selected: false, + disabled: false + } + ], + selection: "single" +}; export const MultiSelect = MultiSelectTemplate.bind({}); -MultiSelect.args = {}; +MultiSelect.argTypes = { + buttons: { + name: 'Buttons', + description: 'Configure various aspects of the buttons within the segmented button group.', + control: 'object' + } +} +MultiSelect.args = { + buttons: [ + { + label: "Sauce", + value: "sauce", + selected: false, + disabled: false + }, + { + label: "Cheese", + value: "cheese", + selected: false, + disabled: false + }, + { + label: "Crust", + value: "crust", + selected: false, + disabled: false + }, + { + label: "Toppings", + value: "toppings", + selected: false, + disabled: false + }, + ], + selection: "multi" +}; export const IconSelect = IconSelectTemplate.bind({}); -IconSelect.args = {}; \ No newline at end of file +IconSelect.args = { + selection: "multi" +};