Skip to content

Commit

Permalink
Merge branch 'main' into adam/lg-3959-combobox-value-change
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSonOfThomp authored Jan 29, 2024
2 parents 063c289 + e476768 commit 95ff2a4
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 65 deletions.
5 changes: 5 additions & 0 deletions .changeset/odd-rabbits-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@leafygreen-ui/button': patch
---

Fixes disabled state styling when a button is focused or active
36 changes: 26 additions & 10 deletions packages/button/src/Button.story.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/* eslint-disable react/jsx-key */
/* eslint-disable react/display-name */
import React from 'react';
import { userEvent, within } from '@storybook/testing-library';

import Icon, { glyphs } from '@leafygreen-ui/icon';
import {
type PlayFn,
storybookArgTypes,
type StoryMetaType,
type StoryType,
Expand All @@ -24,7 +22,13 @@ const meta: StoryMetaType<typeof Button> = {
parameters: {
default: 'LiveExample',
generate: {
storyNames: ['LargeSize', 'DefaultSize', 'SmallSize', 'XSmallSize'],
storyNames: [
'LargeSize',
'DefaultSize',
'SmallSize',
'XSmallSize',
'InteractiveStates',
],
combineArgs: {
darkMode: [false, true],
rightGlyph: [undefined, <Icon glyph={'ArrowRight'} />],
Expand Down Expand Up @@ -111,13 +115,6 @@ LiveExample.parameters = {
},
};

export const Focused: StoryType<typeof Button> = LiveExample.bind({});
Focused.play = (async ({ canvasElement }) => {
const canvas = within(canvasElement);
const button = canvas.getByRole('button');
await userEvent.click(button);
}) as PlayFn<typeof Button>;

export const LargeSize: StoryType<typeof Button> = () => <></>;
LargeSize.parameters = {
generate: {
Expand Down Expand Up @@ -154,6 +151,25 @@ XSmallSize.parameters = {
},
};

export const InteractiveStates: StoryType<typeof Button> = () => <></>;
InteractiveStates.parameters = {
generate: {
args: {
rightGlyph: undefined,
leftGlyph: <Icon glyph={'Cloud'} />,
children: 'MongoDB',
variant: 'default',
},
combineArgs: {
// @ts-expect-error - data-hover is not listed as a prop
'data-hover': [false, true],
'data-active': [false, true],
'data-focus': [false, true],
disabled: [false, true],
},
},
};

export const Loading: StoryType<typeof Button> = () => <></>;
Loading.parameters = {
generate: {
Expand Down
Loading

0 comments on commit 95ff2a4

Please sign in to comment.