summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/objects/_card.scss21
-rw-r--r--src/objects/_card.vars.scss12
-rw-r--r--tpl/objects/card.pug11
-rw-r--r--tpl/views/card.pug3
4 files changed, 38 insertions, 9 deletions
diff --git a/src/objects/_card.scss b/src/objects/_card.scss
index e6f266d..d1463d3 100644
--- a/src/objects/_card.scss
+++ b/src/objects/_card.scss
@@ -14,7 +14,7 @@
14 position: relative; 14 position: relative;
15 display: flex; 15 display: flex;
16 flex-direction: column; 16 flex-direction: column;
17 margin: calc(-1 * props.get(vars.$key-focus--border-width)); 17 margin-inline: calc(-1 * props.get(vars.$key-focus--border-width));
18 background-color: props.get(vars.$bg-color); 18 background-color: props.get(vars.$bg-color);
19 background-clip: content-box; 19 background-clip: content-box;
20 border: props.get(vars.$key-focus--border-offset) solid transparent; 20 border: props.get(vars.$key-focus--border-offset) solid transparent;
@@ -55,9 +55,11 @@
55 } 55 }
56 56
57 @include bem.elem('image') { 57 @include bem.elem('image') {
58 position: relative;
58 display: block; 59 display: block;
59 flex: 0 0 auto; 60 flex: 0 0 auto;
60 inline-size: 100%; 61 inline-size: 100%;
62 overflow: hidden;
61 object-fit: cover; 63 object-fit: cover;
62 transition: transform .2s, opacity .2s; 64 transition: transform .2s, opacity .2s;
63 65
@@ -76,6 +78,21 @@
76 } 78 }
77 } 79 }
78 80
81 @include bem.elem('image-img') {
82 display: block;
83 inline-size: 100%;
84 object-fit: cover;
85 }
86
87 @include bem.elem('image-overlay') {
88 position: absolute;
89 inset-block-end: 0;
90 inset-inline: 0;
91 z-index: 10;
92 padding-block: props.get(vars.$image-overlay--pad-b);
93 padding-inline: props.get(vars.$image-overlay--pad-i);
94 }
95
79 @include bem.elem('body') { 96 @include bem.elem('body') {
80 flex: 1 0 auto; 97 flex: 1 0 auto;
81 padding-block: props.get(vars.$pad-b); 98 padding-block: props.get(vars.$pad-b);
@@ -129,7 +146,7 @@
129 146
130 @include bem.modifier('quiet') { 147 @include bem.modifier('quiet') {
131 position: relative; 148 position: relative;
132 margin: 0; 149 margin-inline: 0;
133 background-color: transparent; 150 background-color: transparent;
134 border: 0; 151 border: 0;
135 152
diff --git a/src/objects/_card.vars.scss b/src/objects/_card.vars.scss
index 8ee7158..9cdc177 100644
--- a/src/objects/_card.vars.scss
+++ b/src/objects/_card.vars.scss
@@ -2,11 +2,13 @@
2@use 'iro-sass/src/props'; 2@use 'iro-sass/src/props';
3@use '../core.vars' as core; 3@use '../core.vars' as core;
4 4
5$divider-width: props.def(--o-card--divider-width, props.get(core.$border-width--thin)) !default; 5$divider-width: props.def(--o-card--divider-width, props.get(core.$border-width--thin)) !default;
6$pad-i: props.def(--o-card--pad-i, props.get(core.$size--300)) !default; 6$pad-i: props.def(--o-card--pad-i, props.get(core.$size--300)) !default;
7$pad-b: props.def(--o-card--pad-b, props.get(core.$size--250)) !default; 7$pad-b: props.def(--o-card--pad-b, props.get(core.$size--250)) !default;
8$spacing: props.def(--o-card--spacing, props.get(core.$size--200)) !default; 8$spacing: props.def(--o-card--spacing, props.get(core.$size--200)) !default;
9$rounding: props.def(--o-card--rounding, props.get(core.$rounding)) !default; 9$rounding: props.def(--o-card--rounding, props.get(core.$rounding)) !default;
10$image-overlay--pad-i: props.def(--o-card--image-overlay--pad-i, calc(.5 * props.get($pad-i))) !default;
11$image-overlay--pad-b: props.def(--o-card--image-overlay--pad-b, calc(.5 * props.get($pad-b))) !default;
10 12
11$hover--offset-b: props.def(--o-card--hover--offset-b, calc(-1 * props.get(core.$size--65))) !default; 13$hover--offset-b: props.def(--o-card--hover--offset-b, calc(-1 * props.get(core.$size--65))) !default;
12 14
diff --git a/tpl/objects/card.pug b/tpl/objects/card.pug
index 2ab9bef..e0f6a15 100644
--- a/tpl/objects/card.pug
+++ b/tpl/objects/card.pug
@@ -26,7 +26,16 @@ mixin card-image
26 classes[attributes.class] = true; 26 classes[attributes.class] = true;
27 } 27 }
28 28
29 img(class=classes src=attributes.src style=attributes.style) 29 let imgClasses = {
30 'o-card__image-img': true,
31 'l-card-list__card-image': attributes.list
32 }
33
34 div(class=classes)
35 img(class=imgClasses src=attributes.src style=attributes.style)
36 if block
37 .o-card__image-overlay
38 block
30 39
31mixin card-body 40mixin card-body
32 .o-card__body(style=attributes.style) 41 .o-card__body(style=attributes.style)
diff --git a/tpl/views/card.pug b/tpl/views/card.pug
index 633cf01..61081a9 100644
--- a/tpl/views/card.pug
+++ b/tpl/views/card.pug
@@ -36,6 +36,7 @@ mixin view-card
36 36
37 +card(quiet=true href='#' class='l-card-list__card') 37 +card(quiet=true href='#' class='l-card-list__card')
38 +card-image(src='Drawing_Half.png' style={ 'aspect-ratio': '21 / 9' }) 38 +card-image(src='Drawing_Half.png' style={ 'aspect-ratio': '21 / 9' })
39 +badge= 'Drawings'
39 +card-body 40 +card-body
40 +card-title= 'XS Heading' 41 +card-title= 'XS Heading'
41 +card-content 42 +card-content
@@ -59,7 +60,7 @@ mixin view-card
59 div(class=classes) 60 div(class=classes)
60 each img, i in ['Drawing_Half.png', '0000 Cover@0.5x.webp', 'avatar.png', '01 Design Cody.png', 'avatar.png', 'Drawing_Half.png'] 61 each img, i in ['Drawing_Half.png', '0000 Cover@0.5x.webp', 'avatar.png', '01 Design Cody.png', 'avatar.png', 'Drawing_Half.png']
61 +card(quiet=quiet href='#' class='l-card-list__card') 62 +card(quiet=quiet href='#' class='l-card-list__card')
62 +card-image(src=img class='l-card-list__card-image') 63 +card-image(src=img list=true)
63 +card-body 64 +card-body
64 .l-media 65 .l-media
65 .l-media__block.l-media__block--main 66 .l-media__block.l-media__block--main