UNPKG

4.73 kBtext/lessView Raw
1@import (reference) './imports/global';
2@import (reference) './imports/aui-theme/core/colors.less';
3
4.aui-avatar-size(@type, @size) {
5 &.aui-avatar-@{type} {
6 --aui-avatar-size: @size;
7 }
8}
9
10.aui-avatar-border-size(@type, @size, @border-radius: (@size * @aui-avatar-border-radius-ratio)) {
11 &.aui-avatar-@{type} {
12 --aui-avatar-radius: @border-radius;
13 }
14}
15
16.aui-avatar-group-size(@type, @size) {
17 &.aui-avatar-group-@{type} {
18 --aui-avatar-size: calc(@size + 3px);
19 }
20}
21
22// AUI avatar component
23.aui-avatar {
24 --aui-avatar-size: @aui-avatar-size-medium;
25
26 box-sizing: border-box;
27 display: inline-block;
28 position: relative;
29 vertical-align: text-bottom;
30
31
32 &-inner {
33 display: flex;
34 justify-content: center;
35 align-content: center;
36
37 height: var(--aui-avatar-size);
38 max-width: var(--aui-avatar-size);
39 max-height: var(--aui-avatar-size);
40 width: var(--aui-avatar-size);
41 border-radius: 100%;
42 overflow: hidden;
43 }
44
45 & img {
46 display: block;
47 height: 100%;
48 margin: auto;
49 width: 100%;
50 }
51
52 .aui-avatar-size(xsmall, @aui-avatar-size-xsmall);
53 .aui-avatar-size(small, @aui-avatar-size-small);
54 .aui-avatar-size(medium, @aui-avatar-size-medium);
55 .aui-avatar-size(large, @aui-avatar-size-large);
56 .aui-avatar-size(xlarge, @aui-avatar-size-xlarge);
57 .aui-avatar-size(xxlarge, @aui-avatar-size-xxlarge);
58 .aui-avatar-size(xxxlarge, @aui-avatar-size-xxxlarge);
59
60 // Project avatars - circular and different sizes
61 &-project {
62 --aui-avatar-radius: 3px;
63
64 border-radius: var(--aui-avatar-radius);
65
66 .aui-avatar-inner {
67 border-radius: var(--aui-avatar-radius);
68 }
69
70 .aui-avatar-border-size(xxxlarge, @aui-avatar-size-xxxlarge, 12px);
71 .aui-avatar-border-size(xxlarge, @aui-avatar-size-xxlarge, 6px);
72 .aui-avatar-border-size(xlarge, @aui-avatar-size-xlarge, 6px);
73 .aui-avatar-border-size(large, @aui-avatar-size-large, 3px);
74 .aui-avatar-border-size(medium, @aui-avatar-size-medium, 3px);
75 .aui-avatar-border-size(small, @aui-avatar-size-small, 2px);
76 .aui-avatar-border-size(xsmall, @aui-avatar-size-xsmall, 2px);
77 }
78
79 &-badged {
80 --aui-avatar-badged-size: calc(var(--aui-avatar-size) / 4);
81
82 position: absolute;
83 font-size: 0;
84 line-height: 0;
85 width: var(--aui-avatar-badged-size);
86 height: var(--aui-avatar-badged-size);
87 overflow: hidden;
88 border: 3px solid var(--aui-avatar-outline);
89 border-radius: 100%;
90
91 &-top-start {
92 top: 0;
93 left: 0;
94 }
95
96 &-top-end {
97 top: 0;
98 right: 0;
99 }
100 &-bottom-start {
101 bottom: 0;
102 left: 0;
103 }
104 &-bottom-end {
105 bottom: 0;
106 right: 0;
107 }
108 }
109}
110
111// AUI avatars group component
112.aui-avatar-group {
113 --aui-avatar-size: @aui-avatar-size-medium;
114
115 position: relative;
116 margin-top: calc(var(--aui-avatar-size) / 4);
117 display: block;
118 height: var(--aui-avatar-size);
119
120 &-item {
121 position: absolute;
122 bottom: 0;
123
124 &-hidden {
125 display: none !important;
126 }
127 }
128
129 &-badged {
130 position: absolute;
131 bottom: 0;
132 background-color: var(--aui-body-background);
133 z-index: 1;
134 font-size: calc(var(--aui-avatar-size) / 3);
135 align-items: center;
136 border: 0;
137 cursor: pointer;
138 color: var(--aui-avatar-text);
139 }
140 &-dropdown {
141 box-sizing: border-box;
142 min-width: 160px;
143 max-width: 300px;
144 padding: @aui-dropdown-group-spacing 0;
145 display: none;
146
147 box-shadow: 0 4px 8px var(--aui-shadow2), 0 0 1px var(--aui-shadow2);
148 background: var(--aui-dropdown-bg-color);
149 border: 0 solid var(--aui-dropdown-border-color);
150 border-radius: 3px;
151 position: absolute;
152 top: var(--aui-avatar-size);
153 z-index: 3000;
154
155 &-show {
156 display: block;
157 }
158 }
159
160 & > .aui-avatar > .aui-avatar > .aui-avatar-inner {
161 box-shadow: 0 0 0 3px var(--aui-avatar-outline);
162 }
163
164 .aui-avatar-group-size(xsmall, @aui-avatar-size-xsmall);
165 .aui-avatar-group-size(small, @aui-avatar-size-small);
166 .aui-avatar-group-size(medium, @aui-avatar-size-medium);
167 .aui-avatar-group-size(large, @aui-avatar-size-large);
168 .aui-avatar-group-size(xlarge, @aui-avatar-size-xlarge);
169 .aui-avatar-group-size(xxlarge, @aui-avatar-size-xxlarge);
170 .aui-avatar-group-size(xxxlarge, @aui-avatar-size-xxxlarge);
171}