Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ButtonGroup): address QA design updates #1943

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions src/components/ButtonGroup/ButtonGroup-v2.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,37 @@ type Args = React.ComponentProps<typeof ButtonGroup>;

export const Default: StoryObj<Args> = {};

/**
* Buttons can have a vertical layout.
*/
export const Vertical: StoryObj<Args> = {
args: {
buttonLayout: 'vertical',
},
};

/**
* Primary and secondary buttons can be put along the edges of the tertiary `Button`.
*/
export const HorizontalProgressive: StoryObj<Args> = {
args: {
buttonLayout: 'horizontal-progressive',
},
};

export const WithFiveButtons: StoryObj<Args> = {
/**
* 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> = {
args: {
buttonLayout: 'horizontal-progressive',
children: (
<>
<Button>Button 1</Button>
<Button>Button 2</Button>
<Button>Button 3</Button>
<Button>Button 4</Button>
<Button rank="primary">Button 5</Button>
<Button rank="primary">Primary Button</Button>
<Button className="-ml-size-2" rank="tertiary">
Tertiary Button
</Button>
</>
),
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/ButtonGroup/ButtonGroup-v2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('<ButtonGroup />', () => {
describe('<ButtonGroup /> (v2)', () => {
generateSnapshots(stories as StoryFile);
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<ButtonGroup /> Default story renders snapshot 1`] = `
exports[`<ButtonGroup /> (v2) Default story renders snapshot 1`] = `
<div
class="p-8"
>
Expand Down Expand Up @@ -31,7 +31,7 @@ exports[`<ButtonGroup /> Default story renders snapshot 1`] = `
</div>
`;

exports[`<ButtonGroup /> HorizontalProgressive story renders snapshot 1`] = `
exports[`<ButtonGroup /> (v2) HorizontalProgressive story renders snapshot 1`] = `
<div
class="p-8"
>
Expand Down Expand Up @@ -62,12 +62,12 @@ exports[`<ButtonGroup /> HorizontalProgressive story renders snapshot 1`] = `
</div>
`;

exports[`<ButtonGroup /> Vertical story renders snapshot 1`] = `
exports[`<ButtonGroup /> (v2) HorizontalProgressiveTertiary story renders snapshot 1`] = `
<div
class="p-8"
>
<div
class="button-group button-group--vertical"
class="button-group button-group--horizontal-progressive"
>
<button
class="button button--layout-none button--primary button--lg button--variant-default"
Expand All @@ -76,29 +76,29 @@ exports[`<ButtonGroup /> Vertical story renders snapshot 1`] = `
<span
class="button__text"
>
Button 1
Primary Button
</span>
</button>
<button
class="button button--layout-none button--secondary button--lg button--variant-default"
class="button button--layout-none button--tertiary button--lg button--variant-default -ml-size-2"
type="button"
>
<span
class="button__text"
>
Button 2
Tertiary Button
</span>
</button>
</div>
</div>
`;

exports[`<ButtonGroup /> WithFiveButtons story renders snapshot 1`] = `
exports[`<ButtonGroup /> (v2) Vertical story renders snapshot 1`] = `
<div
class="p-8"
>
<div
class="button-group button-group--horizontal"
class="button-group button-group--vertical"
>
<button
class="button button--layout-none button--primary button--lg button--variant-default"
Expand All @@ -111,7 +111,7 @@ exports[`<ButtonGroup /> WithFiveButtons story renders snapshot 1`] = `
</span>
</button>
<button
class="button button--layout-none button--primary button--lg button--variant-default"
class="button button--layout-none button--secondary button--lg button--variant-default"
type="button"
>
<span
Expand All @@ -120,36 +120,6 @@ exports[`<ButtonGroup /> WithFiveButtons story renders snapshot 1`] = `
Button 2
</span>
</button>
<button
class="button button--layout-none button--primary button--lg button--variant-default"
type="button"
>
<span
class="button__text"
>
Button 3
</span>
</button>
<button
class="button button--layout-none button--primary button--lg button--variant-default"
type="button"
>
<span
class="button__text"
>
Button 4
</span>
</button>
<button
class="button button--layout-none button--primary button--lg button--variant-default"
type="button"
>
<span
class="button__text"
>
Button 5
</span>
</button>
</div>
</div>
`;
Loading