From 1cd5b777ee61f6713f532db30a25c53a250ceeff Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sat, 11 Jun 2022 16:11:25 +0200 Subject: Added list styles --- src/_base.scss | 12 +++++++--- src/_declare-vars.scss | 2 +- src/_scopes.scss | 1 + src/scopes/_blockquotes.scss | 4 ++-- src/scopes/_lists.scss | 52 ++++++++++++++++++++++++++++++++++++++++++++ tpl/index.pug | 2 ++ tpl/views/list.pug | 25 +++++++++++++++++++++ 7 files changed, 92 insertions(+), 6 deletions(-) create mode 100644 src/scopes/_lists.scss create mode 100644 tpl/views/list.pug diff --git a/src/_base.scss b/src/_base.scss index cf7ff05..76589d3 100644 --- a/src/_base.scss +++ b/src/_base.scss @@ -26,7 +26,7 @@ code { pre, code { - @include mx.set-font(--mono, (--size: calc(fn.dim(--font-size --100) - 1px))); + @include mx.set-font(--mono, (--size: .93em)); } pre { @@ -78,8 +78,14 @@ small { ul, ol { - margin: fn.dim(--paragraph --margin-top) 0 0; - padding-left: fn.dim(--list --indent); + margin: 0; + padding: 0; + list-style: none; +} + +li { + margin: 0; + padding: 0; } :focus { diff --git a/src/_declare-vars.scss b/src/_declare-vars.scss index b60374d..ae423c1 100644 --- a/src/_declare-vars.scss +++ b/src/_declare-vars.scss @@ -104,7 +104,7 @@ ), --list: ( - --indent: 3rem, + --indent: fn.dim(--size --400, null), ), ), ), 'dims'); diff --git a/src/_scopes.scss b/src/_scopes.scss index 28c5399..9a9d8ca 100644 --- a/src/_scopes.scss +++ b/src/_scopes.scss @@ -2,4 +2,5 @@ @use 'scopes/invisible-links'; @use 'scopes/code'; @use 'scopes/blockquotes'; +@use 'scopes/lists'; @use 'scopes/headings'; diff --git a/src/scopes/_blockquotes.scss b/src/scopes/_blockquotes.scss index 0942542..37dc565 100644 --- a/src/scopes/_blockquotes.scss +++ b/src/scopes/_blockquotes.scss @@ -4,7 +4,7 @@ @include iro.props-namespace('blockquotes') { @include iro.props-store(( --dims: ( - --pad-x: fn.global-dim(--size --400), + --indent: fn.global-dim(--list --indent), --margin-top: fn.global-dim(--paragraph --margin-top), ) ), 'dims'); @@ -18,7 +18,7 @@ @include iro.bem-scope(iro.props-namespace()) { blockquote { margin: fn.dim(--margin-top) 0 0 1px; - padding-left: calc(fn.dim(--pad-x) - 3px); + padding-left: calc(fn.dim(--indent) - 3px); border-left: 3px solid fn.color(--border); } } diff --git a/src/scopes/_lists.scss b/src/scopes/_lists.scss new file mode 100644 index 0000000..2ea342f --- /dev/null +++ b/src/scopes/_lists.scss @@ -0,0 +1,52 @@ +@use 'iro-sass/src/index' as iro; +@use '../functions' as fn; + +@include iro.props-namespace('lists') { + @include iro.props-store(( + --dims: ( + --indent: fn.global-dim(--list --indent), + --margin-top: fn.global-dim(--paragraph --margin-top), + ) + ), 'dims'); + + @include iro.props-store(( + --colors: ( + --border: fn.global-color(--obj-hi), + ) + ), 'colors'); + + @include iro.bem-scope(iro.props-namespace()) { + ul, + ol { + margin-top: fn.dim(--margin-top); + padding-left: fn.dim(--indent); + + ul, + ol { + margin-top: 0; + } + } + + ul { + list-style: disc; + } + + ol { + list-style: decimal; + } + + dl { + margin: fn.dim(--margin-top) 0 0; + padding: 0; + } + + dt { + color: fn.global-color(--fg-lo); + font-weight: bold; + } + + dd { + margin: 0 0 0 fn.dim(--indent); + } + } +} diff --git a/tpl/index.pug b/tpl/index.pug index f5d2f25..854cb4b 100644 --- a/tpl/index.pug +++ b/tpl/index.pug @@ -54,6 +54,7 @@ include views/divider.pug include views/colored-links.pug include views/code.pug include views/blockquote.pug +include views/list.pug include views/badge.pug include views/button.pug include views/text-field.pug @@ -94,6 +95,7 @@ html +view-colored-links +view-code +view-blockquote + +view-list +view-badge +view-button +view-text-field diff --git a/tpl/views/list.pug b/tpl/views/list.pug new file mode 100644 index 0000000..e3e82bb --- /dev/null +++ b/tpl/views/list.pug @@ -0,0 +1,25 @@ +mixin view-list + +view('list', 'List') + .c-box.s-lists + p.u-mt-0= loremIpsum + ul + li= 'First item' + li= 'Number 2' + ul + li= 'Nested :O' + li= 'Another' + p= loremIpsum + ol + li= 'First item' + li= 'Number 2' + ol + li= 'Nested :O' + li= 'Another' + p= loremIpsum + dl + dt= 'PHP' + dd= 'A server side scripting language.' + dt= 'JavaScript' + dd= 'A client side scripting language.' + p= loremIpsum + -- cgit v1.2.3-70-g09d2