Skip to content

Commit

Permalink
fix(menu-item): fix disabled style (VIV-1772) (#1714)
Browse files Browse the repository at this point in the history
* fix(menu-item): fix disabled style (VIV-1772)

* Refactor css

* Fix css

---------

Co-authored-by: Rachel Bratt Tannenbaum <[email protected]>
  • Loading branch information
RichardHelm and rachelbt authored May 20, 2024
1 parent 62c1563 commit faa3084
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 9 deletions.
26 changes: 19 additions & 7 deletions libs/components/src/lib/menu-item/menu-item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,17 @@
.action {
color: var(#{appearance.get-appearance-token(text)});

:host(:not([check-appearance], [aria-checked='true'])) & {
color: var(#{constants.$vvd-color-neutral-500});
}

.base.trailing & {
order: 2;
}

.base.has-meta & {
order: 2;
}

:host(:not([check-appearance], [aria-checked='true'], [disabled])) & {
color: var(#{constants.$vvd-color-neutral-500});
}
}

.decorative {
Expand Down Expand Up @@ -127,25 +127,37 @@
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
color: var(#{constants.$vvd-color-canvas-text});
font: var(#{constants.$vvd-typography-base});
}

.text-primary {
font: var(#{constants.$vvd-typography-base});
-webkit-line-clamp: var(#{menu-item-variables.$text-primary-line-clamp}, 1);
.base:not(.disabled) & {
color: var(#{constants.$vvd-color-canvas-text});
}
.base.disabled & {
color: var(#{appearance.get-appearance-token(text)});
}
.base.two-lines & {
font: var(#{constants.$vvd-typography-base-bold});
}
}

.text-secondary {
color: var(#{constants.$vvd-color-neutral-800});
font: var(#{constants.$vvd-typography-base-condensed});
-webkit-line-clamp: var(#{menu-item-variables.$text-secondary-line-clamp}, 1);
.base.two-lines:not(.disabled) & {

.base.two-lines & {
color: var(#{constants.$vvd-color-neutral-600});
}
.base.two-lines:not(.disabled).selected & {

.base.disabled & {
color: var(#{appearance.get-appearance-token(text)});
}

.base.selected:not(.disabled) & {
color: var(#{constants.$vvd-color-neutral-800});
}
}
13 changes: 11 additions & 2 deletions libs/components/src/lib/menu-item/ui.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test('should show the component', async ({ page }: { page: Page }) => {
<style>
#wrapper {
width: 250px;
height: 2000px;
height: 2300px;
position: relative;
box-sizing: border-box;
}
Expand Down Expand Up @@ -91,9 +91,18 @@ test('should show the component', async ({ page }: { page: Page }) => {
<vwc-menu-item connotation='cta' role='menuitemradio' text="Radio 2.1" checked></vwc-menu-item>
<vwc-menu-item connotation='cta' role='menuitemradio' text="Radio 2.2"></vwc-menu-item>
<vwc-menu-item connotation='cta' icon='layout-1-solid' role='menuitemcheckbox' text="Checkbox 1" checked></vwc-menu-item>
<vwc-divider></vwc-divider>
<vwc-menu-item disabled text="Disabled item"></vwc-menu-item>
<vwc-menu-item disabled icon="home" text="primary text" text-secondary="secondary text"></vwc-menu-item>
<vwc-menu-item disabled connotation="cta" icon="home" text="primary text" text-secondary="secondary text"></vwc-menu-item>
<vwc-menu-item disabled role="menuitemcheckbox" text="Menu item 1"></vwc-menu-item>
<vwc-menu-item disabled role="menuitemcheckbox" checked text="Menu item 1"></vwc-menu-item>
<vwc-menu-item disabled role="menuitemradio" text="Menu item 1"></vwc-menu-item>
<vwc-menu-item disabled role="menuitemradio" checked text="Menu item 1"></vwc-menu-item>
<vwc-menu-item disabled role="menuitemcheckbox" checked check-appearance="tick-only" text="Menu item 1"></vwc-menu-item>
</vwc-menu>`;

page.setViewportSize({ width: 200, height: 2000 });
page.setViewportSize({ width: 200, height: 2300 });

await loadComponents({
page,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit faa3084

Please sign in to comment.