Files
Oxicloud/static/css/components/userVignette.css
T

215 lines
6.9 KiB
CSS
Raw Normal View History

/* ── User Vignette — avatar circle + name inline component ────────────────────
*
* Reusable component that pairs a coloured initials circle with a display
* name resolved asynchronously. Used in:
* • Owner column (list view, SharedWithMe & Favorites sections)
* • ShareModal member rows, chips, suggestion items
* • User-menu toolbar button and dropdown header (avatar-only mode)
*
* Sizes: --xs (20 px) · --sm (24 px) · --list (36 px) · --md (32 px)
* --lg (40 px) · --menu (38 px) · --xl (48 px)
* Colours: .uv-color-0..4 (applied by JS via _colorIndex(userId) % 5)
*
* All colours use CSS custom properties — no raw hex / rgb / named values.
* ─────────────────────────────────────────────────────────────────────────── */
.user-vignette {
display: inline-flex;
align-items: center;
gap: 6px;
min-width: 0;
overflow: hidden;
}
.user-vignette__avatar {
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
flex-shrink: 0;
/* Default size = --sm; overridden by size modifier below */
width: 24px;
height: 24px;
font-size: 10px;
2026-06-02 12:25:44 +02:00
/* Anchor for the bottom-right `__origin` badge. */
position: relative;
}
.user-vignette__name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 14px;
color: var(--color-text-secondary);
}
/* ── Email mode (showEmail: true) ─────────────────────────────────────────── */
/* Column wrapper used when both name and email are shown. */
.user-vignette__info {
display: flex;
flex-direction: column;
gap: 1px;
min-width: 0;
overflow: hidden;
flex: 1;
}
.user-vignette__email {
font-size: 12px;
color: var(--color-text-faint);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* ── Size variants ─────────────────────────────────────────────────────────── */
.user-vignette--xs .user-vignette__avatar {
width: 20px;
height: 20px;
font-size: 9px;
}
.user-vignette--sm .user-vignette__avatar {
width: 24px;
height: 24px;
font-size: 10px;
}
.user-vignette--list .user-vignette__avatar {
width: 36px;
height: 36px;
font-size: 13px;
}
.user-vignette--md .user-vignette__avatar {
width: 32px;
height: 32px;
font-size: 12px;
}
.user-vignette--lg .user-vignette__avatar {
width: 40px;
height: 40px;
font-size: 15px;
}
.user-vignette--menu .user-vignette__avatar {
width: 38px;
height: 38px;
font-size: 14px;
}
.user-vignette--xl .user-vignette__avatar {
width: 48px;
height: 48px;
font-size: 17px;
}
/* ── Colour palette ────────────────────────────────────────────────────────── */
/* Colours are shared with the ShareModal avatar palette.
Each class maps to a distinct hue via design-token variables. */
.uv-color-0 {
background: var(--color-badge-indigo-bg);
color: var(--color-badge-indigo-text);
}
.uv-color-1 {
background: var(--color-badge-green-bg);
color: var(--color-badge-green-text);
}
.uv-color-2 {
background: var(--color-badge-orange-bg);
color: var(--color-badge-orange-text);
}
.uv-color-3 {
background: var(--color-badge-blue-bg);
color: var(--color-badge-blue-text);
}
.uv-color-4 {
background: var(--color-badge-amber-bg);
color: var(--color-badge-amber-text);
}
/* ── Photo rendering ───────────────────────────────────────────────────────── */
/* When a photo is available the JS replaces the initials text with an <img>.
The avatar <span> keeps its background color as a fallback while loading. */
2026-05-30 23:35:47 +02:00
.user-vignette__avatar img,
.user-vignette__avatar .oxi-icon {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 50%;
display: block;
}
2026-05-30 23:35:47 +02:00
/* ── Group variant ──────────────────────────────────────────────────────────
* `.user-vignette-group` is built by `components/groupVignette.js`. It reuses
* the user-vignette layout + size modifiers (`--xs/sm/md/list/lg/menu/xl`)
* so a row built from a group can swap in for a user without layout shift.
*
* The avatar circle is filled with a neutral surface colour and contains a
* `fa-user-group` icon instead of initials/photo. Single hue for every group
* (rather than the deterministic palette user avatars use) — this is a quick
* visual signal that the row represents a group, not a person. */
.user-vignette-group .user-vignette__avatar {
background: var(--color-badge-blue-bg);
color: var(--color-badge-blue-text);
}
.user-vignette-group .user-vignette__avatar i {
/* Scale the inline-SVG icon (oxi-icon, replaced by icons.js) to fit the
circle. The base `<i>` is 1em — adjust so it sits centred with a small
padding inside the badge regardless of size modifier. */
width: 62%;
height: 62%;
}
.user-vignette-group .user-vignette__avatar .oxi-icon {
width: 100%;
height: 100%;
}
2026-06-02 12:25:44 +02:00
/* ── Origin badge (external-user marker) ───────────────────────────────────
* Tiny FontAwesome icon overlaid on the bottom-right of the avatar circle.
* Shown ONLY for external users — internal users render the bare avatar
* (Ed's "external only" preference: quiet UI for the common case).
*
* The white background ring lifts the icon off coloured avatars so it
* stays readable across the full palette. */
.user-vignette__origin {
position: absolute;
/* Bottom-right corner, slightly tucked past the avatar's edge. */
right: -2px;
bottom: -2px;
/* Scale to ~40% of avatar diameter via em — the parent's font-size
changes per size variant, so the badge naturally tracks. */
font-size: 0.9em;
line-height: 1;
background: var(--color-bg-surface);
color: var(--color-text-secondary);
border-radius: 50%;
/* Halo ring so the icon visually detaches from coloured avatars. */
box-shadow: 0 0 0 1.5px var(--color-bg-surface);
/* Don't intercept hover events on the avatar itself. */
pointer-events: auto;
}
.user-vignette__origin--external {
color: var(--color-warning-orange-text);
}
.user-vignette__origin.hidden {
display: none;
}