Skip to content

Commit

Permalink
feat(PPDSC-2248): update noIcon to hideIcon
Browse files Browse the repository at this point in the history
  • Loading branch information
evgenitsn committed Jul 6, 2022
1 parent 688ef4b commit 788505c
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion site/pages/components/structured-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ const StructuredListComponent = (layoutProps: LayoutProps) => (
'Vertically align the Icon when the StructuredListItem is Link',
},
{
name: 'noIcon',
name: 'hideIcon',
type: 'boolean',
default: 'false',
description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ exports[`StructuredList with href renders four cells with href 1`] = `
</DocumentFragment>
`;

exports[`StructuredList with href renders one cell with disabled link and no icon 1`] = `
exports[`StructuredList with href renders one cell with disabled link and hidden icon 1`] = `
<DocumentFragment>
.emotion-0 {
list-style: none;
Expand Down Expand Up @@ -308,7 +308,7 @@ exports[`StructuredList with href renders one cell with disabled link and no ico
</DocumentFragment>
`;

exports[`StructuredList with href renders one cell with external link and no icon 1`] = `
exports[`StructuredList with href renders one cell with external link and hidden icon 1`] = `
<DocumentFragment>
.emotion-0 {
list-style: none;
Expand Down Expand Up @@ -959,7 +959,7 @@ exports[`StructuredList with href renders one cell with external link icon 1`] =
</DocumentFragment>
`;

exports[`StructuredList with href renders one cell with internal link and no icon 1`] = `
exports[`StructuredList with href renders one cell with internal link and hidden icon 1`] = `
<DocumentFragment>
.emotion-0 {
list-style: none;
Expand Down
22 changes: 11 additions & 11 deletions src/structured-list/__tests__/structured-list.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,45 +247,45 @@ export const StoryStructuredListInteractive = () => (
);
StoryStructuredListInteractive.storyName = 'structured-list-interactive';

export const StoryStructuredListInteractiveNoIcon = () => (
export const StoryStructuredListInteractiveHideIcon = () => (
<>
<StorybookHeading>StructuredList</StorybookHeading>
<StorybookSubHeading>with internal link (no icon)</StorybookSubHeading>
<StorybookSubHeading>with internal link (hide icon)</StorybookSubHeading>
<StructuredListWithDivider>
<ListItemWithInternalLink noIcon ariaLabel="list item">
<ListItemWithInternalLink hideIcon ariaLabel="list item">
<StructuredListCell>
<HeadingTextBlock>Label</HeadingTextBlock>
</StructuredListCell>
<StructuredListCell>
<BodyTextBlock>A short description of the label</BodyTextBlock>
</StructuredListCell>
</ListItemWithInternalLink>
<ListItemWithInternalLink noIcon>
<ListItemWithInternalLink hideIcon>
<StructuredListCell>
<HeadingTextBlock>Label</HeadingTextBlock>
</StructuredListCell>
</ListItemWithInternalLink>
</StructuredListWithDivider>

<StorybookSubHeading>with external link (no icon)</StorybookSubHeading>
<StorybookSubHeading>with external link (hide icon)</StorybookSubHeading>
<StructuredListWithDivider>
<ListItemWithExternalLink noIcon ariaLabel="list item">
<ListItemWithExternalLink hideIcon ariaLabel="list item">
<StructuredListCell>
<HeadingTextBlock>Label</HeadingTextBlock>
</StructuredListCell>
<StructuredListCell>
<BodyTextBlock>A short description of the label</BodyTextBlock>
</StructuredListCell>
</ListItemWithExternalLink>
<ListItemWithExternalLink noIcon>
<ListItemWithExternalLink hideIcon>
<StructuredListCell>
<HeadingTextBlock>Label</HeadingTextBlock>
</StructuredListCell>
</ListItemWithExternalLink>
</StructuredListWithDivider>
<StorybookSubHeading>with disabled link (no icon)</StorybookSubHeading>
<StorybookSubHeading>with disabled link (hide icon)</StorybookSubHeading>
<StructuredListWithDivider>
<StructuredListItem noIcon href="/" disabled ariaLabel="list item">
<StructuredListItem hideIcon href="/" disabled ariaLabel="list item">
<StructuredListCell>
<HeadingTextBlock>Label</HeadingTextBlock>
</StructuredListCell>
Expand All @@ -296,8 +296,8 @@ export const StoryStructuredListInteractiveNoIcon = () => (
</StructuredListWithDivider>
</>
);
StoryStructuredListInteractiveNoIcon.storyName =
'structured-list-interactive-no-icon';
StoryStructuredListInteractiveHideIcon.storyName =
'structured-list-interactive-hide-icon';

export const StoryStructuredListCombined = () => (
<>
Expand Down
12 changes: 6 additions & 6 deletions src/structured-list/__tests__/structured-list.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -334,30 +334,30 @@ describe('StructuredList', () => {
);
});

test('renders one cell with internal link and no icon', () => {
test('renders one cell with internal link and hidden icon', () => {
const props: StructuredListItemProps = {
children: OneCellDefault,
noIcon: true,
hideIcon: true,
};

const fragment = renderToFragmentWithTheme(renderWithInternalLink, props);
expect(fragment).toMatchSnapshot();
});

test('renders one cell with external link and no icon', () => {
test('renders one cell with external link and hidden icon', () => {
const props: StructuredListItemProps = {
children: OneCellDefault,
noIcon: true,
hideIcon: true,
};

const fragment = renderToFragmentWithTheme(renderWithExternalLink, props);
expect(fragment).toMatchSnapshot();
});

test('renders one cell with disabled link and no icon', () => {
test('renders one cell with disabled link and hidden icon', () => {
const props: StructuredListItemProps = {
children: OneCellDefault,
noIcon: true,
hideIcon: true,
};

const fragment = renderToFragmentWithTheme(renderWithDisabledLink, props);
Expand Down
6 changes: 3 additions & 3 deletions src/structured-list/structured-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const ThemelessStructuredListItem = React.forwardRef<
disabled,
overrides,
href,
noIcon,
hideIcon,
linkIconAlign,
eventContext,
eventOriginator = 'list item',
Expand All @@ -47,15 +47,15 @@ const ThemelessStructuredListItem = React.forwardRef<
hasHref &&
childrenArray.length === 2 &&
!getPullRight(childrenArray[1]) &&
!noIcon
!hideIcon
) {
childrenArray.push(
<StructuredListCell align={linkIconAlign} key="link-icon">
<StructuredListIcon href={href} overrides={overrides} />
</StructuredListCell>,
);
}
if (hasHref && childrenArray.length === 1 && !noIcon) {
if (hasHref && childrenArray.length === 1 && !hideIcon) {
childrenArray.push(
<StructuredListCell pullRight align={linkIconAlign} key="link-icon">
<StructuredListIcon href={href} overrides={overrides} />
Expand Down
2 changes: 1 addition & 1 deletion src/structured-list/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface StructuredListItemProps
ariaLabel?: string;
disabled?: boolean;
href?: string;
noIcon?: boolean;
hideIcon?: boolean;
linkIconAlign?: StructuredListCellAlign;
overrides?: {
stylePreset?: MQ<string>;
Expand Down

0 comments on commit 788505c

Please sign in to comment.