From 8f49d0cba610e4829e183e81e4126aba136dfccc Mon Sep 17 00:00:00 2001 From: Volpeon Date: Mon, 7 Feb 2022 18:37:09 +0100 Subject: Added action-menu --- src/objects/_action-menu.scss | 94 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 src/objects/_action-menu.scss (limited to 'src/objects/_action-menu.scss') diff --git a/src/objects/_action-menu.scss b/src/objects/_action-menu.scss new file mode 100644 index 0000000..35d23b8 --- /dev/null +++ b/src/objects/_action-menu.scss @@ -0,0 +1,94 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('action-menu') { + @include iro.props-store(( + --dims: ( + --x: 0, + --y: 0, + --pad-x: 0, + --pad-y: .3rem, + --separator: .3rem, + --rounding: 3px, + --item: ( + --pad-x: .8rem, + --pad-y: .4rem, + ), + ), + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --shadow: 0 .2em .5em rgba(#000, .3), + --separator: fn.global-color(--obj), + --icon: fn.global-color(--fg-hi), + --item: ( + --hover: ( + --bg: fn.global-color(--obj-hi), + --fg: fn.global-color(--fg-lo), + ), + ), + ), + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + @include iro.bem-composed-of('action-button' 'object'); + + position: absolute; + z-index: 10000; + top: fn.dim(--y); + left: fn.dim(--x); + padding: fn.dim(--pad-y) fn.dim(--pad-x); + border-radius: fn.dim(--rounding); + background-color: fn.global-color(--bg); + box-shadow: fn.color(--shadow); + color: fn.global-color(--fg); + + @include iro.bem-modifier('static') { + position: static; + } + + @include iro.bem-modifier('up-left') { + transform: translate(0, -100%); + } + + @include iro.bem-modifier('up-right') { + transform: translate(-100%, -100%); + } + + @include iro.bem-modifier('down-right') { + transform: translate(-100%, 0); + } + + @include iro.bem-elem('separator') { + height: 1px; + margin: fn.dim(--separator) 0; + background-color: fn.color(--separator); + } + + @include iro.bem-elem('item') { + display: block; + box-sizing: border-box; + width: 100%; + padding: fn.dim(--item --pad-y) fn.dim(--item --pad-x); + + @include iro.bem-multi('&:link, &:visited', 'modifier' 'native') { + &:hover, + &:active { + background-color: fn.color(--item --hover --bg); + color: fn.color(--item --hover --fg); + } + } + } + + @include iro.bem-elem('icon-slot') { + display: flex; + justify-content: center; + width: 1em; + } + + @include iro.bem-elem('icon') { + color: fn.color(--icon); + } + } +} -- cgit v1.2.3-70-g09d2