Skip to content

Commit

Permalink
fix(menu-item): Ensure correct order of rendered icons (#7098)
Browse files Browse the repository at this point in the history
**Related Issue:** #7097 

## Summary
Updates the rendered order of icons, updates local demo, adds screenshot
test.
  • Loading branch information
macandcheese authored Jun 2, 2023
1 parent e8d9e05 commit fd344e9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
24 changes: 24 additions & 0 deletions src/components/menu-item/menu-item.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,30 @@ export const iconsBoth = (): string => html` <calcite-menu>
/>
</calcite-menu>`;

export const allIconsAndSubMenu_TestOnly = (): string => html` <calcite-menu>
<calcite-menu-item text="Example item 1" text-enabled></calcite-menu-item>
<calcite-menu-item text="Example item 2" text-enabled active></calcite-menu-item>
<calcite-menu-item text="Example item 3" text-enabled icon-start="layer" icon-end="layer" breadcrumb>
<calcite-menu-item slot="submenu-item" text="Example submenu item 1" text-enabled> </calcite-menu-item>
<calcite-menu-item slot="submenu-item" text="Example submenu item 2" text-enabled>
<calcite-menu-item slot="submenu-item" text="Example submenu item 1" text-enabled></calcite-menu-item>
</calcite-menu-item>
</calcite-menu-item>
<calcite-menu-item text="Example item 4" text-enabled></calcite-menu-item
></calcite-menu>`;

export const allIconsAndSubMenuVertical_TestOnly = (): string => html`<calcite-menu layout="vertical">
<calcite-menu-item text="Example item 1" text-enabled></calcite-menu-item>
<calcite-menu-item text="Example item 2" text-enabled active></calcite-menu-item>
<calcite-menu-item text="Example item 3" text-enabled icon-start="layer" icon-end="layer" breadcrumb>
<calcite-menu-item slot="submenu-item" text="Example submenu item 1" text-enabled> </calcite-menu-item>
<calcite-menu-item slot="submenu-item" text="Example submenu item 2" text-enabled>
<calcite-menu-item slot="submenu-item" text="Example submenu item 1" text-enabled></calcite-menu-item>
</calcite-menu-item>
</calcite-menu-item>
<calcite-menu-item text="Example item 4" text-enabled></calcite-menu-item>
</calcite-menu>`;

export const darkModeRTL_TestOnly = (): string =>
html`<calcite-menu-item
text="Menu item"
Expand Down
4 changes: 2 additions & 2 deletions src/components/menu-item/menu-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,9 @@ export class CalciteMenuItem implements LoadableComponent, T9nComponent, Localiz
<div class={CSS.textContainer}>
<span>{this.text}</span>
</div>
{!this.href && this.hasSubmenu ? this.renderDropdownIcon(dir) : null}
{this.breadcrumb ? this.renderBreadcrumbIcon(dir) : null}
{this.iconEnd && this.renderIconEnd()}
{this.breadcrumb ? this.renderBreadcrumbIcon(dir) : null}
{!this.href && this.hasSubmenu ? this.renderDropdownIcon(dir) : null}
</Fragment>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/demos/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ <h3>
</calcite-menu-item>
</calcite-menu-item>
</calcite-menu-item>
<calcite-menu-item text="Example nested" icon-start="layer">
<calcite-menu-item text="Example nested" icon-start="layer" icon-end="layer">
<calcite-menu-item slot="submenu-item" title text="ArcGIS Online">
<calcite-menu-item slot="submenu-item" text="Great examples"> </calcite-menu-item>
<calcite-menu-item slot="submenu-item" text="Capabilities">
Expand Down

0 comments on commit fd344e9

Please sign in to comment.