-
Notifications
You must be signed in to change notification settings - Fork 597
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(SelectPanel): Add dev stories and update vrt snapshots (#5322)
* chore(SelectPanel): Add dev stories and update vrt snapshots * Adds e2e tests for SelectPanel2 * test(vrt): update snapshots * Add missing classname props and test * test(vrt): update snapshots * wait for thumbnails and fix aat tests * test(vrt): update snapshots * add missing label * test(vrt): update snapshots --------- Co-authored-by: hussam-i-am <[email protected]>
- Loading branch information
1 parent
84c3e62
commit 82c7923
Showing
108 changed files
with
296 additions
and
38 deletions.
There are no files selected for viewing
Binary file added
BIN
+39.8 KB
...ts/SelectPanel.test.ts-snapshots/SelectPanel-With-Css-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.8 KB
...apshots/SelectPanel-With-Css-dark-colorblind-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+40.8 KB
...onents/SelectPanel.test.ts-snapshots/SelectPanel-With-Css-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+40.8 KB
...s-snapshots/SelectPanel-With-Css-dark-dimmed-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+38.9 KB
...SelectPanel.test.ts-snapshots/SelectPanel-With-Css-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+38.9 KB
...hots/SelectPanel-With-Css-dark-high-contrast-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.8 KB
...ts/components/SelectPanel.test.ts-snapshots/SelectPanel-With-Css-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.8 KB
....test.ts-snapshots/SelectPanel-With-Css-dark-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.8 KB
...ts/SelectPanel.test.ts-snapshots/SelectPanel-With-Css-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.8 KB
...apshots/SelectPanel-With-Css-dark-tritanopia-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.6 KB
...s/SelectPanel.test.ts-snapshots/SelectPanel-With-Css-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.6 KB
...pshots/SelectPanel-With-Css-light-colorblind-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.9 KB
...electPanel.test.ts-snapshots/SelectPanel-With-Css-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.9 KB
...ots/SelectPanel-With-Css-light-high-contrast-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.6 KB
...s/components/SelectPanel.test.ts-snapshots/SelectPanel-With-Css-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.6 KB
...test.ts-snapshots/SelectPanel-With-Css-light-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.6 KB
...s/SelectPanel.test.ts-snapshots/SelectPanel-With-Css-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.6 KB
...pshots/SelectPanel-With-Css-light-tritanopia-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+36.5 KB
...ctPanel.test.ts-snapshots/SelectPanel-With-Sx-and-Css-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+36.5 KB
.../SelectPanel-With-Sx-and-Css-dark-colorblind-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+37 KB
...SelectPanel.test.ts-snapshots/SelectPanel-With-Sx-and-Css-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+37 KB
...hots/SelectPanel-With-Sx-and-Css-dark-dimmed-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+35.6 KB
...anel.test.ts-snapshots/SelectPanel-With-Sx-and-Css-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+35.6 KB
...lectPanel-With-Sx-and-Css-dark-high-contrast-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+36.5 KB
...onents/SelectPanel.test.ts-snapshots/SelectPanel-With-Sx-and-Css-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+36.5 KB
...s-snapshots/SelectPanel-With-Sx-and-Css-dark-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.5 KB
...ctPanel.test.ts-snapshots/SelectPanel-With-Sx-and-Css-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.5 KB
.../SelectPanel-With-Sx-and-Css-dark-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.4 KB
...tPanel.test.ts-snapshots/SelectPanel-With-Sx-and-Css-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.4 KB
...SelectPanel-With-Sx-and-Css-light-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.7 KB
...nel.test.ts-snapshots/SelectPanel-With-Sx-and-Css-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.7 KB
...ectPanel-With-Sx-and-Css-light-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.4 KB
...nents/SelectPanel.test.ts-snapshots/SelectPanel-With-Sx-and-Css-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.4 KB
...-snapshots/SelectPanel-With-Sx-and-Css-light-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.4 KB
...tPanel.test.ts-snapshots/SelectPanel-With-Sx-and-Css-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.4 KB
...SelectPanel-With-Sx-and-Css-light-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.5 KB
...nts/SelectPanel.test.ts-snapshots/SelectPanel-With-Sx-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.5 KB
...napshots/SelectPanel-With-Sx-dark-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+37 KB
...ponents/SelectPanel.test.ts-snapshots/SelectPanel-With-Sx-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+37 KB
...ts-snapshots/SelectPanel-With-Sx-dark-dimmed-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+35.6 KB
.../SelectPanel.test.ts-snapshots/SelectPanel-With-Sx-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+35.6 KB
...shots/SelectPanel-With-Sx-dark-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.5 KB
...ots/components/SelectPanel.test.ts-snapshots/SelectPanel-With-Sx-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.5 KB
...l.test.ts-snapshots/SelectPanel-With-Sx-dark-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.5 KB
...nts/SelectPanel.test.ts-snapshots/SelectPanel-With-Sx-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.5 KB
...napshots/SelectPanel-With-Sx-dark-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.4 KB
...ts/SelectPanel.test.ts-snapshots/SelectPanel-With-Sx-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.4 KB
...apshots/SelectPanel-With-Sx-light-colorblind-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.7 KB
...SelectPanel.test.ts-snapshots/SelectPanel-With-Sx-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.7 KB
...hots/SelectPanel-With-Sx-light-high-contrast-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.4 KB
...ts/components/SelectPanel.test.ts-snapshots/SelectPanel-With-Sx-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.4 KB
....test.ts-snapshots/SelectPanel-With-Sx-light-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.4 KB
...ts/SelectPanel.test.ts-snapshots/SelectPanel-With-Sx-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+36.4 KB
...apshots/SelectPanel-With-Sx-light-tritanopia-modern-action-list--true-linux.png
Oops, something went wrong.
Binary file added
BIN
+43.5 KB
...ctPanel.test.ts-snapshots/drafts-SelectPanel-As-Modal-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+44.1 KB
...SelectPanel.test.ts-snapshots/drafts-SelectPanel-As-Modal-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+45.1 KB
...anel.test.ts-snapshots/drafts-SelectPanel-As-Modal-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+43.6 KB
...drafts/SelectPanel.test.ts-snapshots/drafts-SelectPanel-As-Modal-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+43.5 KB
...ctPanel.test.ts-snapshots/drafts-SelectPanel-As-Modal-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+43.6 KB
...tPanel.test.ts-snapshots/drafts-SelectPanel-As-Modal-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+43.9 KB
...nel.test.ts-snapshots/drafts-SelectPanel-As-Modal-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+43.6 KB
...rafts/SelectPanel.test.ts-snapshots/drafts-SelectPanel-As-Modal-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+43.6 KB
...tPanel.test.ts-snapshots/drafts-SelectPanel-As-Modal-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+53.2 KB
....test.ts-snapshots/drafts-SelectPanel-External-Anchor-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+54.6 KB
...anel.test.ts-snapshots/drafts-SelectPanel-External-Anchor-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+52.1 KB
...st.ts-snapshots/drafts-SelectPanel-External-Anchor-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+53.2 KB
...SelectPanel.test.ts-snapshots/drafts-SelectPanel-External-Anchor-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+53.2 KB
....test.ts-snapshots/drafts-SelectPanel-External-Anchor-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+53.3 KB
...test.ts-snapshots/drafts-SelectPanel-External-Anchor-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+53.1 KB
...t.ts-snapshots/drafts-SelectPanel-External-Anchor-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+53.4 KB
...electPanel.test.ts-snapshots/drafts-SelectPanel-External-Anchor-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+53.3 KB
...test.ts-snapshots/drafts-SelectPanel-External-Anchor-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+31 KB
...napshots/drafts-SelectPanel-Instant-Selection-Variant-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+32.9 KB
...ts-snapshots/drafts-SelectPanel-Instant-Selection-Variant-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.1 KB
...shots/drafts-SelectPanel-Instant-Selection-Variant-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+31 KB
...l.test.ts-snapshots/drafts-SelectPanel-Instant-Selection-Variant-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+31 KB
...napshots/drafts-SelectPanel-Instant-Selection-Variant-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+31.4 KB
...apshots/drafts-SelectPanel-Instant-Selection-Variant-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+30.9 KB
...hots/drafts-SelectPanel-Instant-Selection-Variant-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+31.4 KB
....test.ts-snapshots/drafts-SelectPanel-Instant-Selection-Variant-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+31.4 KB
...apshots/drafts-SelectPanel-Instant-Selection-Variant-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+44.5 KB
...anel.test.ts-snapshots/drafts-SelectPanel-With-Errors-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+45.8 KB
...ectPanel.test.ts-snapshots/drafts-SelectPanel-With-Errors-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+44.2 KB
...l.test.ts-snapshots/drafts-SelectPanel-With-Errors-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+44.6 KB
...fts/SelectPanel.test.ts-snapshots/drafts-SelectPanel-With-Errors-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+44.6 KB
...anel.test.ts-snapshots/drafts-SelectPanel-With-Errors-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+45.1 KB
...nel.test.ts-snapshots/drafts-SelectPanel-With-Errors-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+45 KB
....test.ts-snapshots/drafts-SelectPanel-With-Errors-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+45.1 KB
...ts/SelectPanel.test.ts-snapshots/drafts-SelectPanel-With-Errors-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+45.1 KB
...nel.test.ts-snapshots/drafts-SelectPanel-With-Errors-light-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+49.6 KB
...nel.test.ts-snapshots/drafts-SelectPanel-With-Warning-dark-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+51.1 KB
...ctPanel.test.ts-snapshots/drafts-SelectPanel-With-Warning-dark-dimmed-linux.png
Oops, something went wrong.
Binary file added
BIN
+50.1 KB
....test.ts-snapshots/drafts-SelectPanel-With-Warning-dark-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+49.6 KB
...ts/SelectPanel.test.ts-snapshots/drafts-SelectPanel-With-Warning-dark-linux.png
Oops, something went wrong.
Binary file added
BIN
+49.6 KB
...nel.test.ts-snapshots/drafts-SelectPanel-With-Warning-dark-tritanopia-linux.png
Oops, something went wrong.
Binary file added
BIN
+51.3 KB
...el.test.ts-snapshots/drafts-SelectPanel-With-Warning-light-colorblind-linux.png
Oops, something went wrong.
Binary file added
BIN
+52.1 KB
...test.ts-snapshots/drafts-SelectPanel-With-Warning-light-high-contrast-linux.png
Oops, something went wrong.
Binary file added
BIN
+51.3 KB
...s/SelectPanel.test.ts-snapshots/drafts-SelectPanel-With-Warning-light-linux.png
Oops, something went wrong.
Binary file added
BIN
+51.2 KB
...el.test.ts-snapshots/drafts-SelectPanel-With-Warning-light-tritanopia-linux.png
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,80 @@ | ||
import {test, expect} from '@playwright/test' | ||
import {visit} from '../../test-helpers/storybook' | ||
import {themes} from '../../test-helpers/themes' | ||
import {waitForImages} from '../../test-helpers/waitForImages' | ||
|
||
const stories: Array<{ | ||
title: string | ||
id: string | ||
buttonText?: string | ||
}> = [ | ||
{ | ||
title: 'Default', | ||
id: 'experimental-components-selectpanel--default', | ||
}, | ||
{ | ||
id: 'experimental-components-selectpanel-features--as-modal', | ||
title: 'As Modal', | ||
}, | ||
{ | ||
id: 'experimental-components-selectpanel-features--external-anchor', | ||
title: 'External Anchor', | ||
}, | ||
{ | ||
id: 'experimental-components-selectpanel-features--instant-selection-variant', | ||
title: 'Instant Selection Variant', | ||
buttonText: 'Choose a tag', | ||
}, | ||
{ | ||
id: 'experimental-components-selectpanel-features--with-warning', | ||
title: 'With Warning', | ||
buttonText: 'Assignees', | ||
}, | ||
{ | ||
id: 'experimental-components-selectpanel-features--with-errors', | ||
title: 'With Errors', | ||
buttonText: 'Assignees', | ||
}, | ||
] as const | ||
|
||
test.describe('SelectPanel', () => { | ||
test.describe('Default', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'experimental-components-selectpanel--default', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
for (const story of stories) { | ||
test.describe(story.title, () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: story.id, | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
const buttonText = story.buttonText || 'Assign label' | ||
await page.getByText(buttonText).click() | ||
await waitForImages(page) | ||
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot( | ||
`drafts.SelectPanel.${story.title}.${theme}.png`, | ||
) | ||
}) | ||
|
||
// Default state | ||
await page.getByText('Assign label').click() | ||
expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot( | ||
`drafts.SelectPanel.Default.${theme}.png`, | ||
) | ||
}) | ||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: story.id, | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'experimental-components-selectpanel--default', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
// Default state | ||
const buttonText = story.buttonText || 'Assign label' | ||
await page.getByText(buttonText).click() | ||
await waitForImages(page) | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
await page.getByText('Assign label').click() | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
} | ||
}) | ||
} | ||
}) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
166 changes: 166 additions & 0 deletions
166
packages/react/src/SelectPanel/SelectPanel.dev.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
import {TriangleDownIcon} from '@primer/octicons-react' | ||
import type {Meta} from '@storybook/react' | ||
import React, {useState} from 'react' | ||
|
||
import Box from '../Box' | ||
import {Button} from '../Button' | ||
import {SelectPanel} from '.' | ||
import type {ItemInput} from '../deprecated/ActionList/List' | ||
import {FeatureFlags} from '../FeatureFlags' | ||
|
||
const meta = { | ||
title: 'Components/SelectPanel/Dev', | ||
component: SelectPanel, | ||
} satisfies Meta<typeof SelectPanel> | ||
|
||
export default meta | ||
|
||
function getColorCircle(color: string) { | ||
return function () { | ||
return ( | ||
<Box | ||
sx={{ | ||
backgroundColor: color, | ||
borderColor: color, | ||
width: 14, | ||
height: 14, | ||
borderRadius: 10, | ||
margin: 'auto', | ||
borderWidth: '1px', | ||
borderStyle: 'solid', | ||
}} | ||
/> | ||
) | ||
} | ||
} | ||
|
||
const items: ItemInput[] = [ | ||
{leadingVisual: getColorCircle('#a2eeef'), text: 'enhancement', description: 'New feature or request', id: 1}, | ||
{leadingVisual: getColorCircle('#d73a4a'), text: 'bug', description: "Something isn't working", id: 2}, | ||
{leadingVisual: getColorCircle('#0cf478'), text: 'good first issue', description: 'Good for newcomers', id: 3}, | ||
{leadingVisual: getColorCircle('#ffd78e'), text: 'design', id: 4}, | ||
{leadingVisual: getColorCircle('#ff0000'), text: 'blocker', id: 5}, | ||
{leadingVisual: getColorCircle('#a4f287'), text: 'backend', id: 6}, | ||
{leadingVisual: getColorCircle('#8dc6fc'), text: 'frontend', id: 7}, | ||
].map(item => ({...item, descriptionVariant: 'block'})) | ||
|
||
export const WithCss = () => { | ||
const [selected, setSelected] = React.useState<ItemInput[]>([items[0], items[1]]) | ||
const [filter, setFilter] = React.useState('') | ||
const filteredItems = items.filter(item => item.text?.toLowerCase().startsWith(filter.toLowerCase())) | ||
const [open, setOpen] = useState(true) | ||
|
||
return ( | ||
<FeatureFlags | ||
flags={{ | ||
primer_react_css_modules_team: true, | ||
primer_react_css_modules_staff: true, | ||
primer_react_css_modules_ga: true, | ||
}} | ||
> | ||
<h1>Multi Select Panel</h1> | ||
<SelectPanel | ||
title="Select labels" | ||
subtitle="Use labels to organize issues and pull requests" | ||
renderAnchor={({children, 'aria-labelledby': ariaLabelledBy, ...anchorProps}) => ( | ||
<Button | ||
trailingAction={TriangleDownIcon} | ||
aria-labelledby={` ${ariaLabelledBy}`} | ||
{...anchorProps} | ||
aria-haspopup="dialog" | ||
> | ||
{children ?? 'Select Labels'} | ||
</Button> | ||
)} | ||
open={open} | ||
onOpenChange={setOpen} | ||
items={filteredItems} | ||
selected={selected} | ||
onSelectedChange={setSelected} | ||
onFilterChange={setFilter} | ||
className="testCustomClassnameMono" | ||
/> | ||
</FeatureFlags> | ||
) | ||
} | ||
|
||
export const WithSx = () => { | ||
const [selected, setSelected] = React.useState<ItemInput[]>([items[0], items[1]]) | ||
const [filter, setFilter] = React.useState('') | ||
const filteredItems = items.filter(item => item.text?.toLowerCase().startsWith(filter.toLowerCase())) | ||
const [open, setOpen] = useState(true) | ||
|
||
return ( | ||
<FeatureFlags | ||
flags={{ | ||
primer_react_css_modules_team: true, | ||
primer_react_css_modules_staff: true, | ||
primer_react_css_modules_ga: true, | ||
}} | ||
> | ||
<h1>Multi Select Panel</h1> | ||
<SelectPanel | ||
title="Select labels" | ||
subtitle="Use labels to organize issues and pull requests" | ||
renderAnchor={({children, 'aria-labelledby': ariaLabelledBy, ...anchorProps}) => ( | ||
<Button | ||
trailingAction={TriangleDownIcon} | ||
aria-labelledby={` ${ariaLabelledBy}`} | ||
{...anchorProps} | ||
aria-haspopup="dialog" | ||
> | ||
{children ?? 'Select Labels'} | ||
</Button> | ||
)} | ||
open={open} | ||
onOpenChange={setOpen} | ||
items={filteredItems} | ||
selected={selected} | ||
onSelectedChange={setSelected} | ||
onFilterChange={setFilter} | ||
sx={{fontFamily: 'Times New Roman'}} | ||
/> | ||
</FeatureFlags> | ||
) | ||
} | ||
|
||
export const WithSxAndCSS = () => { | ||
const [selected, setSelected] = React.useState<ItemInput[]>([items[0], items[1]]) | ||
const [filter, setFilter] = React.useState('') | ||
const filteredItems = items.filter(item => item.text?.toLowerCase().startsWith(filter.toLowerCase())) | ||
const [open, setOpen] = useState(true) | ||
|
||
return ( | ||
<FeatureFlags | ||
flags={{ | ||
primer_react_css_modules_team: true, | ||
primer_react_css_modules_staff: true, | ||
primer_react_css_modules_ga: true, | ||
}} | ||
> | ||
<h1>Multi Select Panel</h1> | ||
<SelectPanel | ||
title="Select labels" | ||
subtitle="Use labels to organize issues and pull requests" | ||
renderAnchor={({children, 'aria-labelledby': ariaLabelledBy, ...anchorProps}) => ( | ||
<Button | ||
trailingAction={TriangleDownIcon} | ||
aria-labelledby={` ${ariaLabelledBy}`} | ||
{...anchorProps} | ||
aria-haspopup="dialog" | ||
> | ||
{children ?? 'Select Labels'} | ||
</Button> | ||
)} | ||
open={open} | ||
onOpenChange={setOpen} | ||
items={filteredItems} | ||
selected={selected} | ||
onSelectedChange={setSelected} | ||
onFilterChange={setFilter} | ||
sx={{fontFamily: 'Times New Roman'}} | ||
className="testCustomClassnameMono" | ||
/> | ||
</FeatureFlags> | ||
) | ||
} |
Oops, something went wrong.