@gravity-ui/uikit
Version:
Gravity UI base styling and components
125 lines • 4.02 kB
CSS
.g-avatar {
--_--size: 32px;
--_--border-width: 2px;
--_--inner-border-width: 3px;
--_--border-color: currentColor;
--_--background-color: var(--g-color-base-misc-light);
--_--text-color: var(--g-color-text-misc);
--_--font-weight: var(--g-text-body-font-weight);
--_--font-size: var(--g-text-body-1-font-size);
--_--line-height: var(--g-text-body-1-line-height);
overflow: hidden;
display: inline-flex;
justify-content: center;
align-items: center;
width: var(--g-avatar-size, var(--_--size));
height: var(--g-avatar-size, var(--_--size));
border-radius: 50%;
background-color: var(--g-avatar-background-color, var(--_--background-color));
}
.g-avatar_with-border, .g-avatar_view_outlined {
position: relative;
}
.g-avatar_with-border::before, .g-avatar_with-border::after, .g-avatar_view_outlined::before, .g-avatar_view_outlined::after {
content: "";
z-index: 1;
position: absolute;
inset: 0;
border-radius: 50%;
}
.g-avatar_with-border::before, .g-avatar_view_outlined::before {
border: var(--g-avatar-inner-border-width, var(--_--inner-border-width)) solid var(--g-color-base-background);
}
.g-avatar_with-border::after, .g-avatar_view_outlined::after {
border: var(--g-avatar-border-width, var(--_--border-width)) solid var(--g-avatar-border-color, var(--_--border-color));
}
.g-avatar_size_3xs {
--_--size: 16px;
}
.g-avatar_size_2xs {
--_--size: 20px;
}
.g-avatar_size_xs {
--_--size: 24px;
}
.g-avatar_size_s {
--_--size: 28px;
}
.g-avatar_size_m {
--_--size: 32px;
}
.g-avatar_size_l {
--_--size: 42px;
}
.g-avatar_size_xl {
--_--size: 50px;
}
.g-avatar_size_3xs, .g-avatar_size_2xs, .g-avatar_size_xs {
--_--font-weight: var(--g-text-caption-font-weight);
--_--font-size: var(--g-text-caption-1-font-size);
--_--line-height: var(--g-text-caption-1-line-height);
}
.g-avatar_size_s {
--_--font-weight: var(--g-text-caption-font-weight);
--_--font-size: var(--g-text-caption-2-font-size);
--_--line-height: var(--g-text-caption-2-line-height);
}
.g-avatar_size_m, .g-avatar_size_l {
--_--font-weight: var(--g-text-subheader-font-weight);
--_--font-size: var(--g-text-subheader-1-font-size);
--_--line-height: var(--g-text-subheader-1-line-height);
}
.g-avatar_size_xl {
--_--font-weight: var(--g-text-subheader-font-weight);
--_--font-size: var(--g-text-subheader-2-font-size);
--_--line-height: var(--g-text-subheader-2-line-height);
}
.g-avatar_size_3xs, .g-avatar_size_2xs {
--_--border-width: 1.5px;
--_--inner-border-width: 2.5px;
}
.g-avatar_size_xs, .g-avatar_size_s, .g-avatar_size_m, .g-avatar_size_l, .g-avatar_size_xl {
--_--border-width: 2px;
--_--inner-border-width: 3px;
}
.g-avatar_theme_normal.g-avatar_view_filled {
--_--background-color: var(--g-color-base-misc-light);
--_--text-color: var(--g-color-text-misc);
}
.g-avatar_theme_normal.g-avatar_view_outlined {
--_--background-color: var(--g-color-base-background);
--_--border-color: var(--g-color-text-misc);
--_--text-color: var(--g-color-text-misc);
}
.g-avatar_theme_brand.g-avatar_view_filled {
--_--background-color: var(--g-color-base-brand);
--_--text-color: var(--g-color-text-brand-contrast);
}
.g-avatar_theme_brand.g-avatar_view_outlined {
--_--background-color: var(--g-color-base-background);
--_--border-color: var(--g-color-text-brand);
--_--text-color: var(--g-color-text-brand);
}
.g-avatar__image {
box-sizing: border-box;
display: block;
width: 100%;
height: 100%;
border-radius: inherit;
object-fit: cover;
}
.g-avatar__image_with-border {
border: 1px solid var(--g-color-line-generic);
}
.g-avatar__icon {
color: var(--g-avatar-text-color, var(--_--text-color));
}
.g-avatar__icon > svg {
display: block;
}
.g-avatar__text {
color: var(--g-avatar-text-color, var(--_--text-color));
font-weight: var(--g-avatar-font-weight, var(--_--font-weight));
font-size: var(--g-avatar-font-size, var(--_--font-size));
line-height: var(--g-avatar-line-height, var(--_--line-height));
}