diff options
Diffstat (limited to 'src/objects/_thumbnail.scss')
-rw-r--r-- | src/objects/_thumbnail.scss | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/src/objects/_thumbnail.scss b/src/objects/_thumbnail.scss new file mode 100644 index 0000000..8702fbe --- /dev/null +++ b/src/objects/_thumbnail.scss | |||
@@ -0,0 +1,102 @@ | |||
1 | @use 'sass:map'; | ||
2 | @use 'sass:meta'; | ||
3 | @use 'sass:string'; | ||
4 | @use 'iro-sass/src/bem'; | ||
5 | @use 'iro-sass/src/props'; | ||
6 | @use '../props' as *; | ||
7 | |||
8 | @forward 'thumbnail.vars'; | ||
9 | @use 'thumbnail.vars' as vars; | ||
10 | |||
11 | @mixin styles { | ||
12 | @include materialize-at-root(meta.module-variables('vars')); | ||
13 | |||
14 | @include bem.object('thumbnail') { | ||
15 | position: relative; | ||
16 | inline-size: props.get(vars.$size); | ||
17 | block-size: props.get(vars.$size); | ||
18 | overflow: hidden; | ||
19 | border-radius: props.get(vars.$rounding); | ||
20 | outline: props.get(vars.$border-color) solid props.get(vars.$border-width); | ||
21 | outline-offset: calc(-1 * props.get(vars.$border-width)); | ||
22 | opacity: .75; | ||
23 | |||
24 | &:hover, | ||
25 | &:active, | ||
26 | &:focus-visible { | ||
27 | outline-color: props.get(vars.$hover--border-color); | ||
28 | opacity: 1; | ||
29 | } | ||
30 | |||
31 | @include bem.is('selected') { | ||
32 | $focus-border-offset: calc(-1 * props.get(vars.$selected--border-width)); | ||
33 | |||
34 | margin: $focus-border-offset; | ||
35 | border: props.get(vars.$selected--border-width) solid props.get(vars.$selected--border-color); | ||
36 | border-radius: calc(props.get(vars.$rounding) - $focus-border-offset); | ||
37 | outline: none; | ||
38 | opacity: 1; | ||
39 | } | ||
40 | |||
41 | @include bem.elem('image') { | ||
42 | position: absolute; | ||
43 | inset-block-start: 0; | ||
44 | inset-inline-start: 0; | ||
45 | display: block; | ||
46 | inline-size: 100%; | ||
47 | block-size: 100%; | ||
48 | object-fit: cover; | ||
49 | object-position: center center; | ||
50 | } | ||
51 | |||
52 | @include bem.elem('icon') { | ||
53 | position: absolute; | ||
54 | inset-block-start: 50%; | ||
55 | inset-inline-start: 50%; | ||
56 | transform: translate(-50%, -50%); | ||
57 | } | ||
58 | |||
59 | &:focus-visible { | ||
60 | $focus-border-offset: calc(-1 * props.get(vars.$key-focus--border-offset)); | ||
61 | |||
62 | margin: $focus-border-offset; | ||
63 | border: props.get(vars.$key-focus--border-offset) solid transparent; | ||
64 | border-radius: calc(props.get(vars.$rounding) - $focus-border-offset); | ||
65 | outline: props.get(vars.$key-focus--border-color) solid props.get(vars.$key-focus--border-width); | ||
66 | outline-offset: 0; | ||
67 | box-shadow: | ||
68 | 0 | ||
69 | 0 | ||
70 | 0 | ||
71 | calc(props.get(vars.$key-focus--outline-width) + props.get(vars.$key-focus--border-width)) | ||
72 | props.get(vars.$key-focus--outline-color); | ||
73 | } | ||
74 | |||
75 | @each $theme in map.keys(props.get(vars.$static-themes)) { | ||
76 | @include bem.modifier(string.slice($theme, 3)) { | ||
77 | outline-color: props.get(vars.$static-themes, $theme, --border); | ||
78 | |||
79 | &:hover, | ||
80 | &:active, | ||
81 | &:focus-visible { | ||
82 | outline-color: props.get(vars.$static-themes, $theme, --hover, --border); | ||
83 | } | ||
84 | |||
85 | @include bem.is('selected') { | ||
86 | border-color: props.get(vars.$static-themes, $theme, --selected, --border); | ||
87 | } | ||
88 | |||
89 | &:focus-visible { | ||
90 | border-color: transparent; | ||
91 | outline-color: props.get(vars.$static-themes, $theme, --key-focus, --border); | ||
92 | box-shadow: | ||
93 | 0 | ||
94 | 0 | ||
95 | 0 | ||
96 | calc(props.get(vars.$key-focus--outline-width) + props.get(vars.$key-focus--border-width)) | ||
97 | props.get(vars.$static-themes, $theme, --key-focus, --outline); | ||
98 | } | ||
99 | } | ||
100 | } | ||
101 | } | ||
102 | } | ||