From 679b9b108101b67ad56b4fdf35ec2bd0568d8d84 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Thu, 9 Nov 2023 15:44:54 +0100 Subject: Renamed "bubble" to "message", added message group merging --- tpl/objects/bubble-group.pug | 17 -------------- tpl/objects/bubble.pug | 52 ----------------------------------------- tpl/objects/message-group.pug | 19 +++++++++++++++ tpl/objects/message.pug | 54 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 69 deletions(-) delete mode 100644 tpl/objects/bubble-group.pug delete mode 100644 tpl/objects/bubble.pug create mode 100644 tpl/objects/message-group.pug create mode 100644 tpl/objects/message.pug (limited to 'tpl/objects') diff --git a/tpl/objects/bubble-group.pug b/tpl/objects/bubble-group.pug deleted file mode 100644 index 4fcb1a4..0000000 --- a/tpl/objects/bubble-group.pug +++ /dev/null @@ -1,17 +0,0 @@ -mixin bubble-group(user) - - - let classes = { - 'l-bubble-group': true, - 'l-bubble-group--compact': attributes.compact, - 'l-bubble-group--left': attributes.left, - 'l-bubble-group--right': attributes.right, - 'l-bubble-group--arrow': attributes.arrow - } - if (attributes.class) { - classes[attributes.class] = true - } - - section(class=classes) - .l-bubble-group__avatar.u-p-sticky-top - +avatar= user.slice(0, 2) - block diff --git a/tpl/objects/bubble.pug b/tpl/objects/bubble.pug deleted file mode 100644 index 6a3ea8b..0000000 --- a/tpl/objects/bubble.pug +++ /dev/null @@ -1,52 +0,0 @@ -mixin bubble(user) - - const slots = {} - - mixin slot(key) - - slots[key] = block - - - - block ? block() : undefined - - let classes = { - 'o-bubble': true, - 'o-bubble--75': attributes.compact, - 'o-bubble--highlight': attributes.highlight, - 't-up': !attributes.theme - } - if (attributes.class) { - classes[attributes.class] = true - } - if (attributes.theme) { - classes[attributes.theme] = true - } - - let headerClasses = { - 'o-bubble__header': true, - 'u-mb-50': !attributes.compact, - } - - mixin content - if slots.header - header(class=headerClasses) - - slots.header() - else if user - header(class=headerClasses) - strong= user - span.s-links.s-links--colored - - slots.body() - if slots.time - small.o-bubble__suffix - - slots.time() - if slots.footer - footer.o-bubble__footer - - slots.footer() - - article(class=classes) - if user && attributes.avatar - .l-media.l-media--flush.l-flex--align-start - .l-media__block.u-mt-50.u-p-sticky-top - +avatar= user.slice(0, 2) - .l-media__block.l-media__block--main - +content - else - +content diff --git a/tpl/objects/message-group.pug b/tpl/objects/message-group.pug new file mode 100644 index 0000000..e5e055c --- /dev/null +++ b/tpl/objects/message-group.pug @@ -0,0 +1,19 @@ +mixin message-group(user) + - + let classes = { + 'l-message-group': true, + 'l-message-group--compact': attributes.compact, + 'l-message-group--left': attributes.left, + 'l-message-group--right': attributes.right, + 'l-message-group--arrow': attributes.arrow, + 'l-message-group--group': attributes.group, + 'l-message-group--merge': attributes.merge + } + if (attributes.class) { + classes[attributes.class] = true + } + + section(class=classes) + .l-message-group__avatar.u-p-sticky-top + +avatar= user.slice(0, 2) + block diff --git a/tpl/objects/message.pug b/tpl/objects/message.pug new file mode 100644 index 0000000..d644347 --- /dev/null +++ b/tpl/objects/message.pug @@ -0,0 +1,54 @@ +mixin message(user) + - const slots = {} + + mixin slot(key) + - slots[key] = block + + - + block ? block() : undefined + + let classes = { + 'o-message': true, + 'o-message--bubble': attributes.bubble || !!attributes.theme, + 'o-message--75': attributes.compact, + 'o-message--highlight': attributes.highlight, + 'l-message-group__message': attributes.group + } + if (attributes.class) { + classes[attributes.class] = true + } + if (attributes.theme) { + classes[attributes.theme] = true + } + + let headerClasses = { + 'o-message__header': true, + 'l-message-group__merge-hide': true, + 'u-mb-50': !attributes.compact, + } + + mixin content + if slots.header + header(class=headerClasses) + - slots.header() + else if user + header(class=headerClasses) + strong= user + span.s-links.s-links--colored + - slots.body() + if slots.time + small.o-message__suffix + - slots.time() + if slots.footer + footer.o-message__footer + - slots.footer() + + article(class=classes) + if user && attributes.avatar + .l-media.l-media--flush.l-flex--align-start + .l-media__block.u-mt-50.u-p-sticky-top + +avatar= user.slice(0, 2) + .l-media__block.l-media__block--main + +content + else + +content -- cgit v1.2.3-70-g09d2