chore: Remove dropdown utilities sass file
Move utilities sass file chevron definitions into dropdown styles in favour of a single dropdown style
This commit is contained in:
6 files changed
+21
-54
No files matched your search
@@ -1,33 +1,21 @@
|
||||
import { Meta, Story, Preview } from '@storybook/addon-docs/blocks';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
import { action } from '@storybook/addon-actions';
|
||||
import { text, boolean, select } from '@storybook/addon-knobs';
|
||||
|
||||
<Meta title="Rose|Dropdown" component="Dropdown" />
|
||||
|
||||
# Dropdown
|
||||
|
||||
A simple dropdown component with support for links and buttons. Supports `light` and `dark` styles, with latter being a default style.
|
||||
A simple dropdown component with support for links and buttons.
|
||||
|
||||
<Preview>
|
||||
<Story name="Basic Dropdown" height="5rem">{{
|
||||
template: hbs`
|
||||
<Rose::Dropdown @text="Choose One…" @icon="user-organization" @style={{style}} as |dropdown|>
|
||||
<Rose::Dropdown @text="Choose One…" @icon="user-organization" as |dropdown|>
|
||||
<dropdown.link @route="index">Menu item</dropdown.link>
|
||||
<dropdown.link @route="about">Menu item</dropdown.link>
|
||||
<dropdown.button>Button menu item</dropdown.button>
|
||||
</Rose::Dropdown>
|
||||
`,
|
||||
context: {
|
||||
style: select(
|
||||
'style',
|
||||
{
|
||||
'light': 'light',
|
||||
'dark': 'dark',
|
||||
},
|
||||
'dark'
|
||||
),
|
||||
}
|
||||
}}</Story>
|
||||
</Preview>
|
||||
|
||||
@@ -40,7 +28,6 @@ A simple dropdown component with support for links and buttons. Supports `light`
|
||||
<dropdown.button>Button menu item</dropdown.button>
|
||||
</Rose::Dropdown>
|
||||
`,
|
||||
context: {}
|
||||
}}</Story>
|
||||
</Preview>
|
||||
|
||||
|
||||
@@ -1,22 +1,7 @@
|
||||
@use '../variables/sizing';
|
||||
@use '../utilities/type';
|
||||
@use '../utilities/dropdown';
|
||||
|
||||
@include dropdown.dropdown-style(
|
||||
'light',
|
||||
(
|
||||
color: var(--white),
|
||||
chevron: 'light',
|
||||
)
|
||||
);
|
||||
|
||||
@include dropdown.dropdown-style(
|
||||
'dark',
|
||||
(
|
||||
color: var(--black),
|
||||
chevron: 'dark',
|
||||
)
|
||||
);
|
||||
$chevron: "data:image/svg+xml;utf-8,<svg viewBox='0 0 24 24' fill='%231b1f26' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6-1.41-1.41z'></path></svg>";
|
||||
|
||||
.rose-dropdown {
|
||||
position: relative;
|
||||
@@ -31,6 +16,8 @@
|
||||
padding: 0 sizing.rems(xl) 0 sizing.rems(l);
|
||||
$lineHeight: 36 / 13;
|
||||
line-height: $lineHeight;
|
||||
color: var(--black);
|
||||
background: url($chevron) no-repeat right sizing.rems(s) center;
|
||||
|
||||
// Hide default twistie triangle
|
||||
// Webkit / Chromium
|
||||
@@ -136,7 +123,11 @@
|
||||
width: 100%;
|
||||
|
||||
&.rose-button-warning {
|
||||
color: unset;
|
||||
color: var(--failure);
|
||||
|
||||
&:hover {
|
||||
color: var(--white);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,18 @@
|
||||
@use '../../variables/sizing';
|
||||
@use '../../utilities/type';
|
||||
|
||||
$chevron: "data:image/svg+xml;utf-8,<svg viewBox='0 0 24 24' fill='%23ebeef2' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6-1.41-1.41z'></path></svg>";
|
||||
|
||||
.rose-header-utilities,
|
||||
.rose-header-nav {
|
||||
margin-right: sizing.rems(s);
|
||||
|
||||
.rose-dropdown-trigger {
|
||||
background-size: sizing.rems(m);
|
||||
$lineHeight: 48 / 16;
|
||||
line-height: $lineHeight;
|
||||
color: var(--white);
|
||||
background: url($chevron) no-repeat right center;
|
||||
background-size: sizing.rems(m);
|
||||
|
||||
.rose-icon {
|
||||
--size: #{sizing.rems(l)};
|
||||
@@ -28,3 +32,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.rose-header-nav .rose-dropdown-trigger{
|
||||
padding-right: sizing.rems(l);
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
@use 'sass:map';
|
||||
@use '../variables/sizing';
|
||||
|
||||
$dropdown-chevron: (
|
||||
'light':
|
||||
"data:image/svg+xml;utf-8,<svg viewBox='0 0 24 24' fill='%23ebeef2' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6-1.41-1.41z'></path></svg>",
|
||||
'dark':
|
||||
"data:image/svg+xml;utf-8,<svg viewBox='0 0 24 24' fill='%231b1f26' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6-1.41-1.41z'></path></svg>",
|
||||
);
|
||||
|
||||
@mixin dropdown-style($name, $default) {
|
||||
.rose-dropdown-#{$name} {
|
||||
.rose-dropdown-trigger {
|
||||
color: map.get($default, color);
|
||||
background: url(map.get($dropdown-chevron, map.get($default, chevron)))
|
||||
no-repeat right sizing.rems(s) center;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<details
|
||||
...attributes
|
||||
class="rose-dropdown {{if @alignRight " rose-dropdown-right"}} {{if @style (concat "rose-dropdown-" @style)}} {{unless @style (concat "rose-dropdown-dark")}}"
|
||||
class="rose-dropdown {{if @alignRight " rose-dropdown-right"}}"
|
||||
{{on-click-outside this.close}}
|
||||
>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="rose-header-utilities">
|
||||
{{yield (hash
|
||||
dropdown=(component 'rose/dropdown' alignRight=true style="light")
|
||||
dropdown=(component 'rose/dropdown' alignRight=true)
|
||||
)}}
|
||||
</div>
|
||||
Reference in new issue
Block a user