From 5983cf075646ecafa6a9a528c10e73aa0db77470 Mon Sep 17 00:00:00 2001 From: Manuel Carrera Date: Wed, 10 Jun 2020 16:11:28 -0600 Subject: [PATCH 1/4] test(drawer): Add stories and snapshots for drawer --- .../_labs/drawer/react/lib/DrawerHeader.tsx | 9 +- .../react/stories/stories_visualTesting.tsx | 86 +++++++++++++++++++ modules/side-panel/react/lib/SidePanel.tsx | 26 ++---- 3 files changed, 100 insertions(+), 21 deletions(-) create mode 100644 modules/_labs/drawer/react/stories/stories_visualTesting.tsx diff --git a/modules/_labs/drawer/react/lib/DrawerHeader.tsx b/modules/_labs/drawer/react/lib/DrawerHeader.tsx index 65a922b3c0..f54eb94845 100644 --- a/modules/_labs/drawer/react/lib/DrawerHeader.tsx +++ b/modules/_labs/drawer/react/lib/DrawerHeader.tsx @@ -8,7 +8,7 @@ export interface DrawerHeaderProps extends React.HTMLAttributes /** * The text of the DrawerHeader. This text will also be applied as the `title` attribute of the header element. */ - headerText?: string; + title?: string; /** * The function called when the DrawerHeader close button is clicked. */ @@ -39,7 +39,9 @@ export interface DrawerHeaderProps extends React.HTMLAttributes const headerHeight = 56; -const HeaderContainer = styled('div')>( +const HeaderContainer = styled('div')< + Pick +>( { height: headerHeight, display: 'flex', @@ -67,7 +69,7 @@ const HeaderTitle = styled(H4)>( }) ); -const CloseButton = styled(IconButton)({ +const CloseButton = styled(IconButton)>({ margin: '-8px', // for inverse and plain button, we always want this margin }); @@ -76,7 +78,6 @@ export default class DrawerHeader extends React.Component closeIconLabel: 'Close', headerColor: colors.soap100, borderColor: colors.soap500, - showInverseButton: false, inverse: false, }; diff --git a/modules/_labs/drawer/react/stories/stories_visualTesting.tsx b/modules/_labs/drawer/react/stories/stories_visualTesting.tsx new file mode 100644 index 0000000000..2c50f70476 --- /dev/null +++ b/modules/_labs/drawer/react/stories/stories_visualTesting.tsx @@ -0,0 +1,86 @@ +/// +import * as React from 'react'; +import {StaticStates} from '@workday/canvas-kit-labs-react-core'; +import { + ComponentStatesTable, + permutateProps, + withSnapshotsEnabled, +} from '../../../../../utils/storybook'; +import {spacing} from '@workday/canvas-kit-react-core'; + +import {Drawer, DrawerHeader, DrawerDirection} from '../index'; +import {action} from '@storybook/addon-actions'; + +export default withSnapshotsEnabled({ + title: 'Testing|React/Labs/Drawer', + component: Drawer, +}); + +export const DrawerStates = () => ( +
+

Drawer

+ + + {props => ( +
+ Drawer Content +
+ )} +
+
+

Drawer With Header

+ + + {props => ( +
+ }>Drawer Content +
+ )} +
+
+
+); diff --git a/modules/side-panel/react/lib/SidePanel.tsx b/modules/side-panel/react/lib/SidePanel.tsx index 90a761b147..9baddba34a 100644 --- a/modules/side-panel/react/lib/SidePanel.tsx +++ b/modules/side-panel/react/lib/SidePanel.tsx @@ -53,12 +53,12 @@ export interface SidePanelProps extends React.HTMLAttributes { * The `aria-label` that describes closing the navigation. * @default 'close navigation' */ - closeNavigationLabel: string; + closeNavigationAriaLabel?: string; /** * The `aria-label` that describes opening the navigation. * @default 'open navigation' */ - openNavigationLabel: string; + openNavigationAriaLabel?: string; } export interface SidePanelState { @@ -169,15 +169,6 @@ export default class SidePanel extends React.Component Date: Wed, 10 Jun 2020 16:18:57 -0600 Subject: [PATCH 2/4] fix: Remove inverse prop from styled --- modules/_labs/drawer/react/lib/DrawerHeader.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/_labs/drawer/react/lib/DrawerHeader.tsx b/modules/_labs/drawer/react/lib/DrawerHeader.tsx index f54eb94845..e2c5f98e37 100644 --- a/modules/_labs/drawer/react/lib/DrawerHeader.tsx +++ b/modules/_labs/drawer/react/lib/DrawerHeader.tsx @@ -39,9 +39,7 @@ export interface DrawerHeaderProps extends React.HTMLAttributes const headerHeight = 56; -const HeaderContainer = styled('div')< - Pick ->( +const HeaderContainer = styled('div')>( { height: headerHeight, display: 'flex', @@ -69,7 +67,7 @@ const HeaderTitle = styled(H4)>( }) ); -const CloseButton = styled(IconButton)>({ +const CloseButton = styled(IconButton)({ margin: '-8px', // for inverse and plain button, we always want this margin }); From 910b8c1cdfe4e15b6e311c6dd45c45aed60e588b Mon Sep 17 00:00:00 2001 From: Manuel Carrera Date: Wed, 10 Jun 2020 16:22:10 -0600 Subject: [PATCH 3/4] fix: Add dep to package --- modules/_labs/drawer/react/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/_labs/drawer/react/package.json b/modules/_labs/drawer/react/package.json index 7913bf38ce..acb8eda099 100644 --- a/modules/_labs/drawer/react/package.json +++ b/modules/_labs/drawer/react/package.json @@ -43,5 +43,8 @@ }, "peerDependencies": { "react": ">= 16.8 < 17" + }, + "devDependencies": { + "@workday/canvas-kit-labs-react-core": "^3.8.0" } } From a540d8c5949867a73a9522cb09828e7e9f076931 Mon Sep 17 00:00:00 2001 From: Manuel Carrera Date: Wed, 10 Jun 2020 16:38:17 -0600 Subject: [PATCH 4/4] fix: Remove unused import --- .../_labs/drawer/react/stories/stories_visualTesting.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/_labs/drawer/react/stories/stories_visualTesting.tsx b/modules/_labs/drawer/react/stories/stories_visualTesting.tsx index 2c50f70476..80294a3514 100644 --- a/modules/_labs/drawer/react/stories/stories_visualTesting.tsx +++ b/modules/_labs/drawer/react/stories/stories_visualTesting.tsx @@ -1,11 +1,7 @@ /// import * as React from 'react'; import {StaticStates} from '@workday/canvas-kit-labs-react-core'; -import { - ComponentStatesTable, - permutateProps, - withSnapshotsEnabled, -} from '../../../../../utils/storybook'; +import {ComponentStatesTable, withSnapshotsEnabled} from '../../../../../utils/storybook'; import {spacing} from '@workday/canvas-kit-react-core'; import {Drawer, DrawerHeader, DrawerDirection} from '../index';