From 08466080a960cd9944d559c481085a23dabffbf0 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sat, 4 Feb 2023 21:30:26 +0100 Subject: Scrollable dialog improvements --- src/objects/_backdrop.scss | 1 + src/objects/_dialog.scss | 10 ++++++++++ tpl/objects/dialog.pug | 5 +++-- tpl/views/dialog.pug | 12 +++++++++++- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/objects/_backdrop.scss b/src/objects/_backdrop.scss index 7653a99..fee5577 100644 --- a/src/objects/_backdrop.scss +++ b/src/objects/_backdrop.scss @@ -31,6 +31,7 @@ left: 0; box-sizing: border-box; flex-direction: column; + overflow: auto; background-color: fn.color(--bg); color: fn.global-color(--fg); backdrop-filter: blur(fn.dim(--blur)); diff --git a/src/objects/_dialog.scss b/src/objects/_dialog.scss index b935f8d..a85fd1f 100644 --- a/src/objects/_dialog.scss +++ b/src/objects/_dialog.scss @@ -58,6 +58,7 @@ 'sidebar footer'; position: relative; box-sizing: border-box; + flex: 0 0 auto; width: 100%; max-width: fn.dim(--width-md); margin: 0 auto; @@ -120,6 +121,15 @@ padding: fn.dim(--body --pad-y) fn.dim(--body --pad-x); } + @include iro.bem-modifier('scrollable') { + flex-shrink: 1; + + @include iro.bem-elem('body') { + overflow: auto; + scrollbar-color: fn.global-color(--obj-lo) transparent; + } + } + @include iro.bem-modifier('flat') { @include iro.bem-elem('header') { border-bottom: 0; diff --git a/tpl/objects/dialog.pug b/tpl/objects/dialog.pug index 2a2530f..26b953b 100644 --- a/tpl/objects/dialog.pug +++ b/tpl/objects/dialog.pug @@ -10,8 +10,9 @@ mixin dialog(title) block ? block() : undefined let classes = { - 'o-dialog': true, - 'o-dialog--flat': attributes.flat, + 'o-dialog': true, + 'o-dialog--flat': attributes.flat, + 'o-dialog--scrollable': attributes.scrollable, } let headerClass = { diff --git a/tpl/views/dialog.pug b/tpl/views/dialog.pug index 6ef06df..5a659dd 100644 --- a/tpl/views/dialog.pug +++ b/tpl/views/dialog.pug @@ -8,7 +8,17 @@ mixin view-dialog .c-box +backdrop(pad=true) - +dialog('Lorem ipsum')(bodyClass='l-overflow') + +dialog('Lorem ipsum') + +slot('body') + p.u-mt-0= loremIpsum + p= loremIpsum + p= loremIpsum + p= loremIpsum + p= loremIpsum + + .c-box + +backdrop(pad=true) + +dialog('Lorem ipsum')(scrollable=true) +slot('body') p.u-mt-0= loremIpsum p= loremIpsum -- cgit v1.2.3-54-g00ecf