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