diff options
author | Volpeon <git@volpeon.ink> | 2022-02-06 20:23:11 +0100 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2022-02-06 20:23:11 +0100 |
commit | 9691ccf48f64dd0fac669ae51943907cc8da9b78 (patch) | |
tree | 01fa18eee29ec1266bbe3d276a8dac6f54390f16 /src/objects/_avatar.scss | |
parent | Fixes (diff) | |
download | iro-design-9691ccf48f64dd0fac669ae51943907cc8da9b78.tar.gz iro-design-9691ccf48f64dd0fac669ae51943907cc8da9b78.tar.bz2 iro-design-9691ccf48f64dd0fac669ae51943907cc8da9b78.zip |
Added status indicator and avatar
Diffstat (limited to 'src/objects/_avatar.scss')
-rw-r--r-- | src/objects/_avatar.scss | 89 |
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 | } | ||