summaryrefslogtreecommitdiffstats
path: root/src/objects/_lightbox.scss
diff options
context:
space:
mode:
Diffstat (limited to 'src/objects/_lightbox.scss')
-rw-r--r--src/objects/_lightbox.scss104
1 files changed, 58 insertions, 46 deletions
diff --git a/src/objects/_lightbox.scss b/src/objects/_lightbox.scss
index 740f4e5..66faab5 100644
--- a/src/objects/_lightbox.scss
+++ b/src/objects/_lightbox.scss
@@ -1,14 +1,16 @@
1@use 'sass:map';
2@use 'sass:meta';
3@use 'sass:string';
1@use 'iro-sass/src/iro-sass' as iro; 4@use 'iro-sass/src/iro-sass' as iro;
2@use '../functions' as fn; 5@use '../props';
3 6
4@use 'action-button'; 7@forward 'lightbox.vars';
8@use 'lightbox.vars' as vars;
5 9
6$static-themes: 'black' 'white' !default; 10@mixin styles {
11 @include props.materialize(meta.module-variables('vars'));
7 12
8@include iro.props-namespace('lightbox') { 13 @include iro.bem-object('lightbox') {
9
10
11 @include iro.bem-object(iro.props-namespace()) {
12 box-sizing: border-box; 14 box-sizing: border-box;
13 display: grid; 15 display: grid;
14 flex: 1 1 auto; 16 flex: 1 1 auto;
@@ -25,8 +27,8 @@ $static-themes: 'black' 'white' !default;
25 display: flex; 27 display: flex;
26 grid-area: header; 28 grid-area: header;
27 align-items: flex-start; 29 align-items: flex-start;
28 padding-block-start: fn.dim(--pad); 30 padding-block-start: props.get(vars.$pad);
29 padding-inline: fn.dim(--pad); 31 padding-inline: props.get(vars.$pad);
30 } 32 }
31 33
32 @include iro.bem-elem('img') { 34 @include iro.bem-elem('img') {
@@ -36,7 +38,7 @@ $static-themes: 'black' 'white' !default;
36 place-self: center; 38 place-self: center;
37 max-inline-size: 100%; 39 max-inline-size: 100%;
38 max-block-size: 100%; 40 max-block-size: 100%;
39 padding: fn.dim(--pad); 41 padding: props.get(vars.$pad);
40 42
41 @include iro.bem-sibling-elem('img') { 43 @include iro.bem-sibling-elem('img') {
42 @include iro.bem-modifier('default') { 44 @include iro.bem-modifier('default') {
@@ -82,9 +84,9 @@ $static-themes: 'black' 'white' !default;
82 @include iro.bem-elem('thumbnails') { 84 @include iro.bem-elem('thumbnails') {
83 display: flex; 85 display: flex;
84 grid-area: thumbnails; 86 grid-area: thumbnails;
85 gap: fn.dim(--thumbnail --spacing); 87 gap: props.get(vars.$thumbnail--spacing);
86 padding: fn.dim(--pad); 88 padding: props.get(vars.$pad);
87 margin-block-start: calc(-1 * fn.dim(--pad)); 89 margin-block-start: calc(-1 * props.get(vars.$pad));
88 overflow: auto; 90 overflow: auto;
89 } 91 }
90 92
@@ -92,47 +94,52 @@ $static-themes: 'black' 'white' !default;
92 display: flex; 94 display: flex;
93 grid-area: footer; 95 grid-area: footer;
94 align-items: flex-start; 96 align-items: flex-start;
95 padding-block: 0 fn.dim(--pad); 97 padding-block: 0 props.get(vars.$pad);
96 padding-inline: fn.dim(--pad); 98 padding-inline: props.get(vars.$pad);
97 } 99 }
98 100
99 @include iro.bem-elem('thumbnail') { 101 @include iro.bem-elem('thumbnail') {
100 position: relative; 102 position: relative;
101 flex: 0 0 auto; 103 flex: 0 0 auto;
102 inline-size: fn.dim(--thumbnail --size); 104 inline-size: props.get(vars.$thumbnail--size);
103 block-size: fn.dim(--thumbnail --size); 105 block-size: props.get(vars.$thumbnail--size);
104 overflow: hidden; 106 overflow: hidden;
105 border-radius: fn.dim(--thumbnail --rounding); 107 border-radius: props.get(vars.$thumbnail--rounding);
106 outline: fn.dim(--thumbnail --border) solid fn.color(--thumbnail --border); 108 outline: props.get(vars.$thumbnail--border-color) solid props.get(vars.$thumbnail--border-width);
107 outline-offset: calc(-1 * fn.dim(--thumbnail --border)); 109 outline-offset: calc(-1 * props.get(vars.$thumbnail--border-width));
108 opacity: .75; 110 opacity: .75;
109 111
110 &:hover, 112 &:hover,
111 &:active, 113 &:active,
112 &:focus-visible { 114 &:focus-visible {
113 outline-color: fn.color(--thumbnail --hover --border); 115 outline-color: props.get(vars.$thumbnail--hover--border-color);
114 opacity: 1; 116 opacity: 1;
115 } 117 }
116 118
117 @include iro.bem-is('selected') { 119 @include iro.bem-is('selected') {
118 $focus-border-offset: calc(-1 * fn.dim(--thumbnail --selected --border)); 120 $focus-border-offset: calc(-1 * props.get(vars.$thumbnail--selected--border-width));
119 121
120 margin: $focus-border-offset; 122 margin: $focus-border-offset;
121 border: fn.dim(--thumbnail --selected --border) solid fn.color(--thumbnail --selected --border); 123 border: props.get(vars.$thumbnail--selected--border-width) solid props.get(vars.$thumbnail--selected--border-color);
122 border-radius: calc(fn.dim(--thumbnail --rounding) - $focus-border-offset); 124 border-radius: calc(props.get(vars.$thumbnail--rounding) - $focus-border-offset);
123 outline: none; 125 outline: none;
124 opacity: 1; 126 opacity: 1;
125 } 127 }
126 128
127 &:focus-visible { 129 &:focus-visible {
128 $focus-border-offset: calc(-1 * fn.dim(--thumbnail --key-focus --border-offset)); 130 $focus-border-offset: calc(-1 * props.get(vars.$thumbnail--key-focus--border-offset));
129 131
130 margin: $focus-border-offset; 132 margin: $focus-border-offset;
131 border: fn.dim(--thumbnail --key-focus --border-offset) solid transparent; 133 border: props.get(vars.$thumbnail--key-focus--border-offset) solid transparent;
132 border-radius: calc(fn.dim(--thumbnail --rounding) - $focus-border-offset); 134 border-radius: calc(props.get(vars.$thumbnail--rounding) - $focus-border-offset);
133 outline: fn.dim(--thumbnail --key-focus --border) solid fn.color(--thumbnail --key-focus --border); 135 outline: props.get(vars.$thumbnail--key-focus--border-color) solid props.get(vars.$thumbnail--key-focus--border-width);
134 outline-offset: 0; 136 outline-offset: 0;
135 box-shadow: 0 0 0 calc(fn.dim(--thumbnail --key-focus --outline) + fn.dim(--thumbnail --key-focus --border)) fn.color(--thumbnail --key-focus --outline); 137 box-shadow:
138 0
139 0
140 0
141 calc(props.get(vars.$thumbnail--key-focus--outline-width) + props.get(vars.$thumbnail--key-focus--border-width))
142 props.get(vars.$thumbnail--key-focus--outline-color);
136 } 143 }
137 } 144 }
138 145
@@ -156,9 +163,9 @@ $static-themes: 'black' 'white' !default;
156 163
157 @include iro.bem-elem('close-btn') { 164 @include iro.bem-elem('close-btn') {
158 flex: 0 0 auto; 165 flex: 0 0 auto;
159 margin-block-start: calc(-.5 * fn.dim(--pad)); 166 margin-block-start: calc(-.5 * props.get(vars.$pad));
160 margin-inline: auto calc(-.5 * fn.dim(--pad)); 167 margin-inline: auto calc(-.5 * props.get(vars.$pad));
161 font-size: fn.dim(--close-button --font-size); 168 font-size: props.get(vars.$close-button--font-size);
162 } 169 }
163 170
164 @include iro.bem-elem('nav-btn') { 171 @include iro.bem-elem('nav-btn') {
@@ -166,21 +173,21 @@ $static-themes: 'black' 'white' !default;
166 display: none; 173 display: none;
167 align-self: center; 174 align-self: center;
168 overflow: visible; 175 overflow: visible;
169 font-size: fn.dim(--nav-button --font-size); 176 font-size: props.get(vars.$nav-button--font-size);
170 177
171 &::before { 178 &::before {
172 position: absolute; 179 position: absolute;
173 inset-block-start: 50%; 180 inset-block-start: 50%;
174 display: block; 181 display: block;
175 inline-size: fn.dim(--nav-button --width); 182 inline-size: props.get(vars.$nav-button--inline-size);
176 block-size: fn.dim(--nav-button --height); 183 block-size: props.get(vars.$nav-button--block-size);
177 content: ''; 184 content: '';
178 transform: translateY(-50%); 185 transform: translateY(-50%);
179 } 186 }
180 187
181 @include iro.bem-modifier('prev') { 188 @include iro.bem-modifier('prev') {
182 grid-area: prev; 189 grid-area: prev;
183 margin-inline: calc(.5 * fn.dim(--pad)) calc(-1 * fn.dim(--pad)); 190 margin-inline: calc(.5 * props.get(vars.$pad)) calc(-1 * props.get(vars.$pad));
184 191
185 &::before { 192 &::before {
186 inset-inline-start: 0; 193 inset-inline-start: 0;
@@ -189,35 +196,40 @@ $static-themes: 'black' 'white' !default;
189 196
190 @include iro.bem-modifier('next') { 197 @include iro.bem-modifier('next') {
191 grid-area: next; 198 grid-area: next;
192 margin-inline: calc(-1 * fn.dim(--pad)) calc(.5 * fn.dim(--pad)); 199 margin-inline: calc(-1 * props.get(vars.$pad)) calc(.5 * props.get(vars.$pad));
193 200
194 &::before { 201 &::before {
195 inset-inline-end: 0; 202 inset-inline-end: 0;
196 } 203 }
197 } 204 }
198 } 205 }
199 206
200 @each $theme in $static-themes { 207 @each $theme in map.keys(props.get(vars.$static-themes)) {
201 @include iro.bem-modifier(static-#{$theme}) { 208 @include iro.bem-modifier(string.slice($theme, 3)) {
202 color: fn.color(--static-#{$theme} --text); 209 color: props.get(vars.$static-themes, $theme, --text);
203 210
204 @include iro.bem-elem('thumbnail') { 211 @include iro.bem-elem('thumbnail') {
205 outline-color: fn.color(--static-#{$theme} --thumbnail --border); 212 outline-color: props.get(vars.$static-themes, $theme, --thumbnail, --border);
206 213
207 &:hover, 214 &:hover,
208 &:active, 215 &:active,
209 &:focus-visible { 216 &:focus-visible {
210 outline-color: fn.color(--static-#{$theme} --thumbnail --hover --border); 217 outline-color: props.get(vars.$static-themes, $theme, --thumbnail, --hover, --border);
211 } 218 }
212 219
213 @include iro.bem-is('selected') { 220 @include iro.bem-is('selected') {
214 border-color: fn.color(--static-#{$theme} --thumbnail --selected --border); 221 border-color: props.get(vars.$static-themes, $theme, --thumbnail, --selected, --border);
215 } 222 }
216 223
217 &:focus-visible { 224 &:focus-visible {
218 border-color: transparent; 225 border-color: transparent;
219 outline-color: fn.color(--static-#{$theme} --thumbnail --key-focus --border); 226 outline-color: props.get(vars.$static-themes, $theme, --thumbnail, --key-focus, --border);
220 box-shadow: 0 0 0 calc(fn.dim(--thumbnail --key-focus --outline) + fn.dim(--thumbnail --key-focus --border)) fn.color(--static-#{$theme} --thumbnail --key-focus --outline); 227 box-shadow:
228 0
229 0
230 0
231 calc(props.get(vars.$thumbnail--key-focus--outline-width) + props.get(vars.$thumbnail--key-focus--border-width))
232 props.get(vars.$static-themes, $theme, --thumbnail, --key-focus, --outline);
221 } 233 }
222 } 234 }
223 } 235 }