From 6aa51b85bf0bde317aa77ba962dbf321ff0027d4 Mon Sep 17 00:00:00 2001 From: Dale Sande Date: Sat, 15 Jan 2022 19:57:59 -0800 Subject: [PATCH] refactor(style): simplify checkmark ui #52 Changes to be committed: modified: demo/demo.md modified: src/auro-menu-option.js modified: src/style-base.scss modified: src/style-menu-option.scss --- demo/demo.md | 14 ++++++++- src/auro-menu-option.js | 15 +++------- src/style-base.scss | 12 ++++++-- src/style-menu-option.scss | 58 +++++++++----------------------------- 4 files changed, 41 insertions(+), 58 deletions(-) diff --git a/demo/demo.md b/demo/demo.md index 81194cd..569c1a7 100644 --- a/demo/demo.md +++ b/demo/demo.md @@ -6,7 +6,7 @@ The `auro-menu` element should be used in situations where users will select one `auro-menu` will be used with `auro-dropdown`. -### index selected option 2; +### index selected option 2, checkmark;
@@ -18,6 +18,18 @@ The `auro-menu` element should be used in situations where users will select one
+### index selected option 2; + +
+ + Stops + (disabled) Price + Duration + Departure + Arrival + +
+ ### Submenu Example
diff --git a/src/auro-menu-option.js b/src/auro-menu-option.js index 6a873fb..9a438d6 100644 --- a/src/auro-menu-option.js +++ b/src/auro-menu-option.js @@ -56,18 +56,11 @@ class AuroMenuOption extends LitElement { render() { return html` -
  • -
    - ${this.checkmark ? html` -
    - ${this.selected ? html` - ${this.svg} - ` - : undefined} -
    - ` : undefined} +
  • `; } diff --git a/src/style-base.scss b/src/style-base.scss index 1fdc177..51cf112 100644 --- a/src/style-base.scss +++ b/src/style-base.scss @@ -17,13 +17,21 @@ width: 100%; } +:host([checkmark]) { + ::slotted(auro-menu-option) { + padding-left: 2rem; + } + + ::slotted([selected]) { + padding-left: 0; + } +} + ul { display: inline-block; width: 100%; padding: 0; margin: 0; - color: var(--auro-color-text-primary-on-light); - size: var(--auro-text-body); vertical-align: middle; .hidden { diff --git a/src/style-menu-option.scss b/src/style-menu-option.scss index 60613a4..9af313b 100644 --- a/src/style-menu-option.scss +++ b/src/style-menu-option.scss @@ -14,69 +14,39 @@ white-space: nowrap; } +:host(:hover) { + background-color: var(--auro-color-brand-neutral-100); + color: var(--auro-color-text-primary-on-light); +} + :host(:focus) { background-color: var(--auro-color-alert-notification-on-light); - box-shadow: inset 0 0 0 3px var(--auro-color-alert-notification-on-light); color: var(--auro-color-base-white); - outline: none; svg { fill: var(--auro-color-base-white); } } -li { - display: flex; - width: 100%; - flex-direction: row; - align-items: center; - padding: 0; - margin: 0; - cursor: pointer; - list-style-type: none; - outline: 0; - - .checkmark { - width: var(--auro-size-lg); - height: 100%; - margin-right: var(--auro-size-xs); - } - - &:hover { - background-color: var(--auro-color-brand-neutral-100); - color: var(--auro-color-text-primary-on-light); - } - - &:focus { - background-color: var(--auro-color-alert-notification-on-light); - color: var(--auro-color-base-white); - - svg { - fill: var(--auro-color-base-white); - } - } +:host([disabled]) { + color: var(--auro-color-text-disabled-on-light); + pointer-events: none; + user-select: none; } -.content { +.menuOption { display: flex; overflow: hidden; height: var(--auro-size-lg); flex: 1; align-items: center; padding: var(--auro-size-xxs) var(--auro-size-xs); + cursor: pointer; line-height: 1; + list-style-type: none; text-overflow: ellipsis; -} -// TODO: review and refactor this -@include auro_breakpoint--sm { - li { - height: var(--auro-size-xxl); + svg { + margin-right: var(--auro-size-xs); } } - -:host([disabled]) { - color: var(--auro-color-text-disabled-on-light); - pointer-events: none; - user-select: none; -}