feat(island): sync components with the Lumina design system
New components:
- Lightbox, NetworkStatus (+ useOnline), TierOption, SkeletonPreset
Rebuilt to the design system:
- PredictionCard: range bar, open KPIs, closed hero, price ladder, horizon progress, seal, locked veil
- CreatorStats: form curve, outcome split, KPI tiles, insights and streak; null renders nothing
- PostCard, LockedTeaser, MediaCarousel: owner action rules, expanded variant, viewer CTA, locked order
- SubscriptionCard: active/suspended/expired/refunded, compact density, amount and support rows
- Countdown, ResendCode, OtpInput: absolute end times, DS wording and thresholds, WebOTP
Fixes:
- Dialog: waits only for finite exit animations, keeps non-dismissible halts open, focuses the
panel, closes on scrim presses only, mounts the panel only while open
- Toaster: moves its region into the open dialog so toasts show and stay tappable over sheets
- Button: blocked submit, frozen cursor, loading links; TextInput focus border; Card, Banner,
ChoiceCard, StepProgress, ErrorState, Amount and Avatar details
- Tokens: muted status tracks, inverse controls, scrim chip, inverse and lightbox focus rings;
the spinner keeps turning under reduced motion
Adds sonner and svgo; island gets the icons target and the hooks subpath.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 13:23:59 +00:00
|
|
|
import { cn } from '../../tools/cn';
|
|
|
|
|
import { Element } from '../../primitives/element';
|
|
|
|
|
import { GridBox } from '../grid-box';
|
|
|
|
|
import { Icon } from '../icon';
|
|
|
|
|
import { Typography } from '../typography';
|
|
|
|
|
import { AVATAR_INITIAL_VARIANT, AVATAR_MARK_PX, AVATAR_PX } from './constants';
|
|
|
|
|
import type { AvatarProps } from './types';
|
|
|
|
|
import { avatarVariants } from './variants';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A circular creator or user picture. The placeholder sits under the image, so it shows while
|
|
|
|
|
* the image loads and when it fails, without client code.
|
|
|
|
|
*/
|
|
|
|
|
export function Avatar({
|
|
|
|
|
name,
|
|
|
|
|
src,
|
|
|
|
|
size = 'md',
|
|
|
|
|
verified = false,
|
feat(island): post card access and share, action menu, tab links, segmented choice
Island pieces for the channel, post page, composer and dashboard.
- New molecules: ActionMenu (links or actions in a popover), TabLinks (route tabs), SegmentedChoice.
- PostCard: owner footer, share menu on desktop, access note for an open premium post, frozen CTA reason on a locked one.
- LockedTeaser keeps the gate's place while the viewer is unknown; Modal gains sizes; Lightbox and skeleton presets for feeds and headers.
- Button: `pressableWhenFrozen`, a frozen look whose press still calls onClick (explain or check instead of a tooltip).
- TextInput counts UTF-16 units, as the native maxLength does, so the counter reaches the limit with it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 16:29:33 +00:00
|
|
|
muted = false,
|
feat(island): sync components with the Lumina design system
New components:
- Lightbox, NetworkStatus (+ useOnline), TierOption, SkeletonPreset
Rebuilt to the design system:
- PredictionCard: range bar, open KPIs, closed hero, price ladder, horizon progress, seal, locked veil
- CreatorStats: form curve, outcome split, KPI tiles, insights and streak; null renders nothing
- PostCard, LockedTeaser, MediaCarousel: owner action rules, expanded variant, viewer CTA, locked order
- SubscriptionCard: active/suspended/expired/refunded, compact density, amount and support rows
- Countdown, ResendCode, OtpInput: absolute end times, DS wording and thresholds, WebOTP
Fixes:
- Dialog: waits only for finite exit animations, keeps non-dismissible halts open, focuses the
panel, closes on scrim presses only, mounts the panel only while open
- Toaster: moves its region into the open dialog so toasts show and stay tappable over sheets
- Button: blocked submit, frozen cursor, loading links; TextInput focus border; Card, Banner,
ChoiceCard, StepProgress, ErrorState, Amount and Avatar details
- Tokens: muted status tracks, inverse controls, scrim chip, inverse and lightbox focus rings;
the spinner keeps turning under reduced motion
Adds sonner and svgo; island gets the icons target and the hooks subpath.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 13:23:59 +00:00
|
|
|
verifiedLabel,
|
|
|
|
|
label,
|
|
|
|
|
className,
|
|
|
|
|
...props
|
|
|
|
|
}: AvatarProps) {
|
|
|
|
|
const px = AVATAR_PX[size];
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Element
|
|
|
|
|
tag="span"
|
|
|
|
|
className={cn('relative inline-block flex-none', className)}
|
|
|
|
|
{...props}
|
|
|
|
|
>
|
|
|
|
|
<GridBox
|
|
|
|
|
tag="span"
|
|
|
|
|
role={label ? 'img' : undefined}
|
|
|
|
|
aria-label={label}
|
|
|
|
|
aria-hidden={label ? undefined : true}
|
|
|
|
|
justifyItems="justify-items-center"
|
|
|
|
|
alignItems="items-center"
|
feat(island): post card access and share, action menu, tab links, segmented choice
Island pieces for the channel, post page, composer and dashboard.
- New molecules: ActionMenu (links or actions in a popover), TabLinks (route tabs), SegmentedChoice.
- PostCard: owner footer, share menu on desktop, access note for an open premium post, frozen CTA reason on a locked one.
- LockedTeaser keeps the gate's place while the viewer is unknown; Modal gains sizes; Lightbox and skeleton presets for feeds and headers.
- Button: `pressableWhenFrozen`, a frozen look whose press still calls onClick (explain or check instead of a tooltip).
- TextInput counts UTF-16 units, as the native maxLength does, so the counter reaches the limit with it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 16:29:33 +00:00
|
|
|
className={avatarVariants({ size, muted })}
|
feat(island): sync components with the Lumina design system
New components:
- Lightbox, NetworkStatus (+ useOnline), TierOption, SkeletonPreset
Rebuilt to the design system:
- PredictionCard: range bar, open KPIs, closed hero, price ladder, horizon progress, seal, locked veil
- CreatorStats: form curve, outcome split, KPI tiles, insights and streak; null renders nothing
- PostCard, LockedTeaser, MediaCarousel: owner action rules, expanded variant, viewer CTA, locked order
- SubscriptionCard: active/suspended/expired/refunded, compact density, amount and support rows
- Countdown, ResendCode, OtpInput: absolute end times, DS wording and thresholds, WebOTP
Fixes:
- Dialog: waits only for finite exit animations, keeps non-dismissible halts open, focuses the
panel, closes on scrim presses only, mounts the panel only while open
- Toaster: moves its region into the open dialog so toasts show and stay tappable over sheets
- Button: blocked submit, frozen cursor, loading links; TextInput focus border; Card, Banner,
ChoiceCard, StepProgress, ErrorState, Amount and Avatar details
- Tokens: muted status tracks, inverse controls, scrim chip, inverse and lightbox focus rings;
the spinner keeps turning under reduced motion
Adds sonner and svgo; island gets the icons target and the hooks subpath.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 13:23:59 +00:00
|
|
|
>
|
|
|
|
|
<Typography
|
|
|
|
|
tag="span"
|
|
|
|
|
variant={AVATAR_INITIAL_VARIANT[size]}
|
|
|
|
|
color="inherit"
|
|
|
|
|
className="font-bold uppercase"
|
|
|
|
|
>
|
|
|
|
|
{Array.from(name)[0] ?? '?'}
|
|
|
|
|
</Typography>
|
|
|
|
|
{src && (
|
|
|
|
|
// A broken image with an empty alt draws nothing, so the letter shows through.
|
|
|
|
|
<Element
|
|
|
|
|
tag="img"
|
|
|
|
|
src={src}
|
|
|
|
|
alt=""
|
|
|
|
|
width={px}
|
|
|
|
|
height={px}
|
|
|
|
|
loading="lazy"
|
|
|
|
|
decoding="async"
|
|
|
|
|
className="absolute inset-0 size-full object-cover"
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</GridBox>
|
|
|
|
|
{verified && (
|
|
|
|
|
<GridBox
|
|
|
|
|
tag="span"
|
|
|
|
|
justifyItems="justify-items-center"
|
|
|
|
|
alignItems="items-center"
|
|
|
|
|
role={verifiedLabel ? 'img' : undefined}
|
|
|
|
|
aria-label={verifiedLabel}
|
|
|
|
|
aria-hidden={verifiedLabel ? undefined : true}
|
|
|
|
|
className="absolute -end-0.5 -bottom-0.5 rounded-full bg-action-primary p-0.5 text-text-on-action ring-2 ring-surface"
|
|
|
|
|
>
|
|
|
|
|
<Icon name="check" size={AVATAR_MARK_PX[size]} strokeWidth={3} />
|
|
|
|
|
</GridBox>
|
|
|
|
|
)}
|
|
|
|
|
</Element>
|
|
|
|
|
);
|
|
|
|
|
}
|