Skip to content

Commit

Permalink
Add anchor to lastName in Storybook (for testing)
Browse files Browse the repository at this point in the history
  • Loading branch information
msmithNI committed May 30, 2024
1 parent f6e6a34 commit e472265
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packages/storybook/src/nimble/table/table.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
} from '../label-provider/base/label-user-stories-utils';
import { createUserSelectedThemeStory } from '../../utilities/storybook';
import { isChromatic } from '../../utilities/isChromatic';
import { tableColumnAnchorTag } from '@ni/nimble-components/dist/esm/table-column/anchor';

interface BaseTableArgs extends LabelUserArgs {
tableRef: Table;
Expand Down Expand Up @@ -74,6 +75,7 @@ interface TableArgs extends BaseTableArgs {
setSelectedRecordIds: undefined;
getSelectedRecordIds: undefined;
data: ExampleDataType;
showLastNameActionMenu: boolean;
}

const simpleData = [
Expand Down Expand Up @@ -302,13 +304,13 @@ export const table: StoryObj<TableArgs> = {
>
<${iconUserTag} title="First Name"></${iconUserTag}>
</${tableColumnTextTag}>
<${tableColumnTextTag}
<${tableColumnAnchorTag}
column-id="last-name-column"
field-name="lastName"
action-menu-slot="name-menu" action-menu-label="Configure name"
label-field-name="lastName" href-field-name="lastName"
action-menu-slot="${x => (x.showLastNameActionMenu ? 'name-menu' : null)}" action-menu-label="${x => (x.showLastNameActionMenu ? 'Configure name' : null)}"
>
Last Name
</${tableColumnTextTag}>
</${tableColumnAnchorTag}>
<${tableColumnNumberTextTag}
column-id="age-column"
field-name="age"
Expand Down Expand Up @@ -362,6 +364,11 @@ export const table: StoryObj<TableArgs> = {
'Controls whether the table supports selecting a single row at a time, multiple rows at a time, or no rows. When selection is enabled, `id-field-name` must be specified.',
control: { type: 'radio' }
},
showLastNameActionMenu: {
name: 'Show Last Name action menu',
description:
'Show Last Name action menu'
},
getSelectedRecordIds: {
name: 'getSelectedRecordIds()',
description:
Expand Down Expand Up @@ -406,6 +413,7 @@ export const table: StoryObj<TableArgs> = {
idFieldName: undefined,
validity: undefined,
checkValidity: undefined,
showLastNameActionMenu: true,
tableRef: undefined,
updateData: x => {
void (async () => {
Expand Down

0 comments on commit e472265

Please sign in to comment.