From 4a567c385f7d16e12da46718d2ee4ff970072711 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Fri, 20 Jan 2023 17:47:42 +0100 Subject: Add emoji object --- src/_objects.scss | 1 + src/objects/_emoji.scss | 39 +++++++++++++++++++++++++++++++++++++++ src/objects/_icon.scss | 4 ++-- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 src/objects/_emoji.scss (limited to 'src') diff --git a/src/_objects.scss b/src/_objects.scss index 3e09104..f054c53 100644 --- a/src/_objects.scss +++ b/src/_objects.scss @@ -1,4 +1,5 @@ @use 'objects/icon'; +@use 'objects/emoji'; @use 'objects/heading'; @use 'objects/divider'; @use 'objects/badge'; diff --git a/src/objects/_emoji.scss b/src/objects/_emoji.scss new file mode 100644 index 0000000..82c415e --- /dev/null +++ b/src/objects/_emoji.scss @@ -0,0 +1,39 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('emoji') { + @include iro.props-store(( + --dims: ( + --size: 1.4em, + --pad: .2em, + --rounding: 3px, + --zoom: 2, + ) + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --bg: fn.global-color(--obj-hi), + ) + ), 'colors'); + + @include iro.bem-object(iro.props-namespace()) { + display: inline; + position: relative; + top: calc(-.5em * fn.global-dim(--font --standard --line-height) + fn.dim(--rounding)); + width: fn.dim(--size); + height: fn.dim(--size); + margin: calc(-.5 * fn.dim(--size)) 0; + padding: fn.dim(--pad); + transition: transform .2s ease, background-color .2s ease; + border-radius: calc(fn.dim(--rounding) / fn.dim(--zoom)); + vertical-align: bottom; + + @include iro.bem-modifier('zoomable') { + &:hover { + transform: scale(fn.dim(--zoom)); + background-color: fn.color(--bg); + } + } + } +} diff --git a/src/objects/_icon.scss b/src/objects/_icon.scss index 12baeba..5a543ab 100644 --- a/src/objects/_icon.scss +++ b/src/objects/_icon.scss @@ -10,13 +10,13 @@ ), 'dims'); @include iro.bem-object(iro.props-namespace()) { - display: inline-block; + display: inline; width: fn.dim(--size); height: fn.dim(--size); stroke-width: fn.dim(--stroke); stroke-linecap: round; stroke-linejoin: round; - vertical-align: -.12em; + vertical-align: -.18em; @include iro.bem-modifier('block') { display: block; -- cgit v1.2.3-70-g09d2