summaryrefslogtreecommitdiffstats
path: root/tpl/objects/message.pug
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2023-11-09 15:44:54 +0100
committerVolpeon <git@volpeon.ink>2023-11-09 15:44:54 +0100
commit679b9b108101b67ad56b4fdf35ec2bd0568d8d84 (patch)
tree1b097e9f90627ca401174c738a8d754e8f2cce6b /tpl/objects/message.pug
parentSimplified bubble arrows (diff)
downloadiro-design-679b9b108101b67ad56b4fdf35ec2bd0568d8d84.tar.gz
iro-design-679b9b108101b67ad56b4fdf35ec2bd0568d8d84.tar.bz2
iro-design-679b9b108101b67ad56b4fdf35ec2bd0568d8d84.zip
Renamed "bubble" to "message", added message group merging
Diffstat (limited to 'tpl/objects/message.pug')
-rw-r--r--tpl/objects/message.pug54
1 files changed, 54 insertions, 0 deletions
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 @@
1mixin message(user)
2 - const slots = {}
3
4 mixin slot(key)
5 - slots[key] = block
6
7 -
8 block ? block() : undefined
9
10 let classes = {
11 'o-message': true,
12 'o-message--bubble': attributes.bubble || !!attributes.theme,
13 'o-message--75': attributes.compact,
14 'o-message--highlight': attributes.highlight,
15 'l-message-group__message': attributes.group
16 }
17 if (attributes.class) {
18 classes[attributes.class] = true
19 }
20 if (attributes.theme) {
21 classes[attributes.theme] = true
22 }
23
24 let headerClasses = {
25 'o-message__header': true,
26 'l-message-group__merge-hide': true,
27 'u-mb-50': !attributes.compact,
28 }
29
30 mixin content
31 if slots.header
32 header(class=headerClasses)
33 - slots.header()
34 else if user
35 header(class=headerClasses)
36 strong= user
37 span.s-links.s-links--colored
38 - slots.body()
39 if slots.time
40 small.o-message__suffix
41 - slots.time()
42 if slots.footer
43 footer.o-message__footer
44 - slots.footer()
45
46 article(class=classes)
47 if user && attributes.avatar
48 .l-media.l-media--flush.l-flex--align-start
49 .l-media__block.u-mt-50.u-p-sticky-top
50 +avatar= user.slice(0, 2)
51 .l-media__block.l-media__block--main
52 +content
53 else
54 +content