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.scss89
1 files changed, 89 insertions, 0 deletions
diff --git a/src/objects/_avatar.scss b/src/objects/_avatar.scss
new file mode 100644
index 0000000..3bdfddc
--- /dev/null
+++ b/src/objects/_avatar.scss
@@ -0,0 +1,89 @@
1@use 'iro-sass/src/index' as iro;
2@use '../functions' as fn;
3
4@include iro.props-namespace('avatar') {
5 @include iro.props-store((
6 --dims: (
7 --size: iro.fn-px-to-rem(40px),
8 --size-sm: iro.fn-px-to-rem(30px),
9 --size-xs: iro.fn-px-to-rem(20px),
10 --indicator-size: fn.foreign-dim(--status-indicator, --size),
11 --indicator-spacing: iro.fn-px-to-rem(3px),
12 --rounding: 25%,
13 ),
14 ), 'dims');
15
16 @include iro.props-store((
17 --colors: (
18 --h: 354,
19 --s: 44%,
20 --l: 45%,
21 ),
22 ), 'colors');
23
24 @include iro.bem-object(iro.props-namespace()) {
25 display: inline-block;
26 position: relative;
27 font-size: 1rem;
28 font-style: normal;
29
30 @include iro.bem-elem('status') {
31 position: absolute;
32 right: 0;
33 bottom: 0;
34
35 @include iro.bem-next-elem('content') {
36 mask-image: radial-gradient(
37 circle calc(.5 * fn.dim(--indicator-size) + fn.dim(--indicator-spacing)) at
38 calc(100% - .5 * fn.dim(--indicator-size))
39 calc(100% - .5 * fn.dim(--indicator-size)),
40 transparent 95%,
41 #fff
42 );
43 }
44 }
45
46 @include iro.bem-elem('content') {
47 display: block;
48 width: fn.dim(--size);
49 height: fn.dim(--size);
50 border-radius: fn.dim(--rounding);
51 background-color: hsl(fn.color(--h), fn.color(--s), fn.color(--l));
52 color: #fff;
53 line-height: fn.dim(--size);
54 text-align: center;
55 }
56
57 @include iro.bem-modifier('circle') {
58 @include iro.bem-elem('content') {
59 border-radius: 100%;
60 }
61 }
62
63 @include iro.bem-modifier('placeholder') {
64 @include iro.bem-elem('content') {
65 background-color: hsl(0, 0%, fn.color(--l));
66 }
67 }
68
69 @include iro.bem-modifier('sm') {
70 font-size: iro.fn-px-to-rem(13px);
71
72 @include iro.bem-elem('content') {
73 width: fn.dim(--size-sm);
74 height: fn.dim(--size-sm);
75 line-height: fn.dim(--size-sm);
76 }
77 }
78
79 @include iro.bem-modifier('xs') {
80 font-size: iro.fn-px-to-rem(12px);
81
82 @include iro.bem-elem('content') {
83 width: fn.dim(--size-xs);
84 height: fn.dim(--size-xs);
85 line-height: fn.dim(--size-xs);
86 }
87 }
88 }
89}