-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TrailingAction support to NavList (#4697)
* Update NavList to support TrailingAction * Update conditional in ActionList to allow NavList to set TrailingAction * add NavList.TrailingAction support * Update logic to not render for ActionMenu or SelectPanel Co-authored-by: Tyler Jones <tylerjdev@github.com> * Create tender-parrots-refuse.md * Fix syntax * Wrap example with PageLayout * Add subitem * Filter out TrailingAction * Add test coverage * Move back to minimize diff * Add bad storybook example * Update Story name * Update e2e tests * Update stories * test(vrt): update snapshots * update docs * Update packages/react/src/NavList/NavList.docs.json Co-authored-by: Tyler Jones <tylerjdev@github.com> * Fix description: * Move to DevOnly * Change to minor * Update snapshots --------- Co-authored-by: Tyler Jones <tylerjdev@github.com> Co-authored-by: khiga8 <khiga8@users.noreply.github.com>
- Loading branch information
1 parent
84f862c
commit a7d1e4f
Showing
30 changed files
with
320 additions
and
29 deletions.
There are no files selected for viewing
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,5 @@ | ||
--- | ||
"@primer/react": minor | ||
--- | ||
|
||
Add TrailingAction support to NavList |
Binary file added
BIN
+7.75 KB
...NavList-With-Bad-Example-of-SubNav-and-TrailingAction-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
+7.75 KB
...ots/NavList-With-Bad-Example-of-SubNav-and-TrailingAction-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
+7.71 KB
...List-With-Bad-Example-of-SubNav-and-TrailingAction-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
+7.75 KB
...-snapshots/NavList-With-Bad-Example-of-SubNav-and-TrailingAction-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
+7.75 KB
...NavList-With-Bad-Example-of-SubNav-and-TrailingAction-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
+7.7 KB
...avList-With-Bad-Example-of-SubNav-and-TrailingAction-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
+7.7 KB
...ist-With-Bad-Example-of-SubNav-and-TrailingAction-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
+7.7 KB
...snapshots/NavList-With-Bad-Example-of-SubNav-and-TrailingAction-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
+7.7 KB
...avList-With-Bad-Example-of-SubNav-and-TrailingAction-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
+6.87 KB
...NavList.test.ts-snapshots/NavList-With-TrailingAction-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
+6.86 KB
...nts/NavList.test.ts-snapshots/NavList-With-TrailingAction-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
+6.84 KB
...List.test.ts-snapshots/NavList-With-TrailingAction-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
+6.87 KB
...components/NavList.test.ts-snapshots/NavList-With-TrailingAction-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
+6.87 KB
...NavList.test.ts-snapshots/NavList-With-TrailingAction-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
+6.84 KB
...avList.test.ts-snapshots/NavList-With-TrailingAction-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
+6.84 KB
...ist.test.ts-snapshots/NavList-With-TrailingAction-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
+6.84 KB
...omponents/NavList.test.ts-snapshots/NavList-With-TrailingAction-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
+6.84 KB
...avList.test.ts-snapshots/NavList-With-TrailingAction-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.
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,63 @@ | ||
import {test, expect} from '@playwright/test' | ||
import {visit} from '../test-helpers/storybook' | ||
import {themes} from '../test-helpers/themes' | ||
|
||
test.describe('NavList', () => { | ||
test.describe('With TrailingAction', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-navlist--with-trailing-action', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot(`NavList.With TrailingAction.${theme}.png`) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-navlist--with-trailing-action', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
await expect(page).toHaveNoViolations() | ||
}) | ||
}) | ||
} | ||
}) | ||
|
||
test.describe('With Bad Example of SubNav and TrailingAction', () => { | ||
for (const theme of themes) { | ||
test.describe(theme, () => { | ||
test('default @vrt', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-navlist-devonly--with-bad-example-of-sub-nav-and-trailing-action', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
|
||
// Default state | ||
expect(await page.screenshot()).toMatchSnapshot( | ||
`NavList.With Bad Example of SubNav and TrailingAction.${theme}.png`, | ||
) | ||
}) | ||
|
||
test('axe @aat', async ({page}) => { | ||
await visit(page, { | ||
id: 'components-navlist-devonly--with-bad-example-of-sub-nav-and-trailing-action', | ||
globals: { | ||
colorScheme: theme, | ||
}, | ||
}) | ||
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
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import type {Meta} from '@storybook/react' | ||
import React from 'react' | ||
import {PageLayout} from '../PageLayout' | ||
import {NavList} from './NavList' | ||
import {ArrowRightIcon, ArrowLeftIcon, BookIcon, FileDirectoryIcon} from '@primer/octicons-react' | ||
|
||
const meta: Meta = { | ||
title: 'Components/NavList/DevOnly', | ||
component: NavList, | ||
parameters: { | ||
layout: 'fullscreen', | ||
}, | ||
} | ||
|
||
export const WithBadExampleOfSubNavAndTrailingAction = () => { | ||
return ( | ||
<PageLayout> | ||
<PageLayout.Pane position="start"> | ||
<NavList> | ||
<NavList.Item> | ||
<NavList.LeadingVisual> | ||
<FileDirectoryIcon /> | ||
</NavList.LeadingVisual> | ||
Item 1 | ||
<NavList.TrailingAction label="Expand sidebar" icon={ArrowLeftIcon} /> | ||
</NavList.Item> | ||
<NavList.Item> | ||
Item 2 | ||
<NavList.TrailingAction as="a" href="#" label="Some action" icon={ArrowRightIcon} /> | ||
</NavList.Item> | ||
<NavList.Item> | ||
Item 3 | ||
<NavList.TrailingAction label="This is not supported and should not render!!!!!" icon={BookIcon} /> | ||
<NavList.SubNav> | ||
<NavList.Item href="#"> | ||
Sub item 1 | ||
<NavList.TrailingAction label="Another action" icon={BookIcon} /> | ||
</NavList.Item> | ||
</NavList.SubNav> | ||
</NavList.Item> | ||
</NavList> | ||
</PageLayout.Pane> | ||
</PageLayout> | ||
) | ||
} | ||
|
||
WithBadExampleOfSubNavAndTrailingAction.storyName = 'With SubNav and Trailing Action (Bad example, do not copy)' | ||
|
||
export default meta |
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
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
Oops, something went wrong.