summaryrefslogtreecommitdiffstats
path: root/src/objects/_avatar.scss
diff options
context:
space:
mode:
Diffstat (limited to 'src/objects/_avatar.scss')
-rw-r--r--src/objects/_avatar.scss131
1 files changed, 41 insertions, 90 deletions
diff --git a/src/objects/_avatar.scss b/src/objects/_avatar.scss
index d9c1105..45567b9 100644
--- a/src/objects/_avatar.scss
+++ b/src/objects/_avatar.scss
@@ -1,101 +1,52 @@
1@use 'sass:list'; 1@use 'sass:meta';
2@use 'iro-sass/src/iro-sass' as iro; 2@use 'iro-sass/src/iro-sass' as iro;
3@use '../functions' as fn; 3@use '../props';
4 4
5$sizes: 'xs' 'sm' 'lg' 'xl' 'xxl' 'xxxl'; 5@forward 'avatar.vars';
6@use 'avatar.vars' as vars;
6 7
7@mixin status($size: ()) { 8@mixin status($indicator-size) {
8 @include iro.bem-elem('status') { 9 @include iro.bem-elem('status') {
9 inline-size: fn.dim(list.join($size, --indicator-size)); 10 inline-size: props.get($indicator-size);
10 block-size: fn.dim(list.join($size, --indicator-size)); 11 block-size: props.get($indicator-size);
11 12
12 @include iro.bem-next-elem('content') { 13 @include iro.bem-next-elem('content') {
13 mask-image: radial-gradient(circle calc(.5 * fn.dim(list.join($size, --indicator-size)) + fn.dim(--indicator-spacing)) at 14 mask-image: radial-gradient(circle calc(.5 * props.get($indicator-size) + props.get(vars.$indicator-spacing)) at
14 calc(100% - .5 * fn.dim(list.join($size, --indicator-size))) 15 calc(100% - .5 * props.get($indicator-size))
15 calc(100% - .5 * fn.dim(list.join($size, --indicator-size))), 16 calc(100% - .5 * props.get($indicator-size)),
16 transparent 95%, 17 transparent 95%,
17 #fff); 18 #fff);
18 } 19 }
19 } 20 }
20} 21}
21 22
22@include iro.props-namespace('avatar') { 23@mixin styles {
23 @include iro.props-store(( 24 @include props.materialize(meta.module-variables('vars'));
24 --dims: (
25 --size: fn.global-dim(--size --500),
26 --font-size: fn.global-dim(--font-size --100),
27 --indicator-size: fn.global-dim(--size --150),
28 --indicator-spacing: fn.global-dim(--size --40),
29 --rounding: 25%,
30 25
31 --xxxl: ( 26 @include iro.bem-object('avatar') {
32 --size: fn.global-dim(--size --1600),
33 --font-size: fn.global-dim(--font-size --800),
34 --indicator-size: fn.global-dim(--size --400),
35 ),
36 --xxl: (
37 --size: fn.global-dim(--size --1200),
38 --font-size: fn.global-dim(--font-size --600),
39 --indicator-size: fn.global-dim(--size --300),
40 ),
41 --xl: (
42 --size: fn.global-dim(--size --800),
43 --font-size: fn.global-dim(--font-size --300),
44 --indicator-size: fn.global-dim(--size --225),
45 ),
46 --lg: (
47 --size: fn.global-dim(--size --650),
48 --font-size: fn.global-dim(--font-size --200),
49 --indicator-size: fn.global-dim(--size --175),
50 ),
51 --sm: (
52 --size: fn.global-dim(--size --375),
53 --font-size: fn.global-dim(--font-size --75),
54 --indicator-size: fn.global-dim(--size --125),
55 ),
56 --xs: (
57 --size: fn.global-dim(--size --250),
58 --font-size: fn.global-dim(--font-size --50),
59 --indicator-size: fn.global-dim(--size --100),
60 ),
61
62 --key-focus: (
63 --border: fn.global-dim(--key-focus --border),
64 --border-offset: fn.global-dim(--key-focus --border-offset),
65 --outline: fn.global-dim(--key-focus --outline),
66 ),
67 ),
68 --colors: (
69 --h: 354,
70 --s: 44%,
71 --l: 45%,
72
73 --key-focus: (
74 --border: fn.global-color(--focus --border),
75 --outline: fn.global-color(--focus --outline),
76 ),
77 ),
78 ));
79
80 @include iro.bem-object(iro.props-namespace()) {
81 position: relative; 27 position: relative;
82 display: inline-block; 28 display: inline-block;
83 font-size: fn.dim(--font-size); 29 font-size: props.get(vars.$font-size);
84 font-style: normal; 30 font-style: normal;
85 vertical-align: .05em; 31 vertical-align: .05em;
86 border-radius: fn.dim(--rounding); 32 border-radius: props.get(vars.$rounding);
87 33
88 &::after { 34 &::after {
89 position: absolute; 35 position: absolute;
90 inset: calc(-1 * fn.dim(--key-focus --border-offset)); 36 inset: calc(-1 * props.get(vars.$key-focus--border-offset));
91 z-index: 1; 37 z-index: 1;
92 display: none; 38 display: none;
93 pointer-events: none; 39 pointer-events: none;
94 content: ''; 40 content: '';
95 border: fn.dim(--key-focus --border-offset) solid transparent; 41 border: props.get(vars.$key-focus--border-offset) solid transparent;
96 border-radius: fn.dim(--rounding); 42 border-radius: props.get(vars.$rounding);
97 outline: fn.color(--key-focus --border) solid fn.dim(--key-focus --border); 43 outline: props.get(vars.$key-focus--border-color) solid props.get(vars.$key-focus--border-width);
98 box-shadow: 0 0 0 calc(fn.dim(--key-focus --border) + fn.dim(--key-focus --outline)) fn.color(--key-focus --outline); 44 box-shadow:
45 0
46 0
47 0
48 calc(props.get(vars.$key-focus--border-width) + props.get(vars.$key-focus--outline-width))
49 props.get(vars.$key-focus--outline-color);
99 } 50 }
100 51
101 @include iro.bem-elem('status') { 52 @include iro.bem-elem('status') {
@@ -104,17 +55,17 @@ $sizes: 'xs' 'sm' 'lg' 'xl' 'xxl' 'xxxl';
104 inset-inline-end: 0; 55 inset-inline-end: 0;
105 } 56 }
106 57
107 @include status; 58 @include status(vars.$indicator-size);
108 59
109 @include iro.bem-elem('content') { 60 @include iro.bem-elem('content') {
110 display: block; 61 display: block;
111 inline-size: fn.dim(--size); 62 inline-size: props.get(vars.$size);
112 block-size: fn.dim(--size); 63 block-size: props.get(vars.$size);
113 line-height: fn.dim(--size); 64 line-height: props.get(vars.$size);
114 text-align: center; 65 text-align: center;
115 object-fit: cover; 66 object-fit: cover;
116 object-position: center center; 67 object-position: center center;
117 border-radius: fn.dim(--rounding); 68 border-radius: props.get(vars.$rounding);
118 } 69 }
119 70
120 @include iro.bem-modifier('circle') { 71 @include iro.bem-modifier('circle') {
@@ -131,27 +82,27 @@ $sizes: 'xs' 'sm' 'lg' 'xl' 'xxl' 'xxxl';
131 82
132 @include iro.bem-modifier('placeholder') { 83 @include iro.bem-modifier('placeholder') {
133 @include iro.bem-elem('content') { 84 @include iro.bem-elem('content') {
134 background-color: hsl(0, 0%, fn.color(--l)); 85 background-color: hsl(0, 0%, props.get(vars.$bg-color--l));
135 } 86 }
136 } 87 }
137 88
138 @include iro.bem-modifier('colored') { 89 @include iro.bem-modifier('colored') {
139 @include iro.bem-elem('content') { 90 @include iro.bem-elem('content') {
140 color: #fff; 91 color: #fff;
141 background-color: hsl(fn.color(--h), fn.color(--s), fn.color(--l)); 92 background-color: hsl(props.get(vars.$bg-color--h), props.get(vars.$bg-color--s), props.get(vars.$bg-color--l));
142 } 93 }
143 } 94 }
144 95
145 @each $size in $sizes { 96 @each $mod, $size, $font-size, $indicator-size in vars.$sizes {
146 @include iro.bem-modifier($size) { 97 @include iro.bem-modifier($mod) {
147 font-size: fn.dim(--#{$size} --font-size); 98 font-size: props.get($font-size);
148 99
149 @include status(--#{$size}); 100 @include status($indicator-size);
150 101
151 @include iro.bem-elem('content') { 102 @include iro.bem-elem('content') {
152 inline-size: fn.dim(--#{$size} --size); 103 inline-size: props.get($size);
153 block-size: fn.dim(--#{$size} --size); 104 block-size: props.get($size);
154 line-height: fn.dim(--#{$size} --size); 105 line-height: props.get($size);
155 } 106 }
156 } 107 }
157 } 108 }