From d446f49c787cdd8ed6f70b1945df2ef8a4eeeb65 Mon Sep 17 00:00:00 2001 From: Andrew Holloway Date: Tue, 14 May 2024 18:22:49 -0500 Subject: [PATCH] fix(ButtonGroup): address QA design updates - add example showing how to align tertiary buttons - remove and update stories --- .../ButtonGroup/ButtonGroup-v2.stories.tsx | 22 +++++--- .../ButtonGroup/ButtonGroup-v2.test.ts | 2 +- .../__snapshots__/ButtonGroup-v2.test.ts.snap | 50 ++++--------------- 3 files changed, 27 insertions(+), 47 deletions(-) diff --git a/src/components/ButtonGroup/ButtonGroup-v2.stories.tsx b/src/components/ButtonGroup/ButtonGroup-v2.stories.tsx index 6d4701170..1c5a8b03d 100644 --- a/src/components/ButtonGroup/ButtonGroup-v2.stories.tsx +++ b/src/components/ButtonGroup/ButtonGroup-v2.stories.tsx @@ -33,27 +33,37 @@ type Args = React.ComponentProps; export const Default: StoryObj = {}; +/** + * Buttons can have a vertical layout. + */ export const Vertical: StoryObj = { args: { buttonLayout: 'vertical', }, }; +/** + * Primary and secondary buttons can be put along the edges of the tertiary `Button`. + */ export const HorizontalProgressive: StoryObj = { args: { buttonLayout: 'horizontal-progressive', }, }; -export const WithFiveButtons: StoryObj = { +/** + * When using a tertiary button, you may adjust the layout to nudge the button's alignment to better flow + * with adjacent content. Use `-ml-X` to set a negative margin within the `ButtonGroup`. + */ +export const HorizontalProgressiveTertiary: StoryObj = { args: { + buttonLayout: 'horizontal-progressive', children: ( <> - - - - - + + ), }, diff --git a/src/components/ButtonGroup/ButtonGroup-v2.test.ts b/src/components/ButtonGroup/ButtonGroup-v2.test.ts index 549a2888d..8f5dccffe 100644 --- a/src/components/ButtonGroup/ButtonGroup-v2.test.ts +++ b/src/components/ButtonGroup/ButtonGroup-v2.test.ts @@ -2,6 +2,6 @@ import { generateSnapshots } from '@chanzuckerberg/story-utils'; import type { StoryFile } from '@storybook/testing-react'; import * as stories from './ButtonGroup-v2.stories'; -describe('', () => { +describe(' (v2)', () => { generateSnapshots(stories as StoryFile); }); diff --git a/src/components/ButtonGroup/__snapshots__/ButtonGroup-v2.test.ts.snap b/src/components/ButtonGroup/__snapshots__/ButtonGroup-v2.test.ts.snap index 95bd2054c..0851e7a52 100644 --- a/src/components/ButtonGroup/__snapshots__/ButtonGroup-v2.test.ts.snap +++ b/src/components/ButtonGroup/__snapshots__/ButtonGroup-v2.test.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[` Default story renders snapshot 1`] = ` +exports[` (v2) Default story renders snapshot 1`] = `
@@ -31,7 +31,7 @@ exports[` Default story renders snapshot 1`] = `
`; -exports[` HorizontalProgressive story renders snapshot 1`] = ` +exports[` (v2) HorizontalProgressive story renders snapshot 1`] = `
@@ -62,12 +62,12 @@ exports[` HorizontalProgressive story renders snapshot 1`] = `
`; -exports[` Vertical story renders snapshot 1`] = ` +exports[` (v2) HorizontalProgressiveTertiary story renders snapshot 1`] = `
`; -exports[` WithFiveButtons story renders snapshot 1`] = ` +exports[` (v2) Vertical story renders snapshot 1`] = `
- - -
`;