Skip to content

Commit 654bfc3

Browse files
committed
feat(webapp): add a 1.25px avatar variant for the team page member rows
Add AvatarCircleIconExtraThin (1.25px stroke) and switch the avatar placeholder's thin boolean to a strokeWidth prop (1.25 | 1.5 | 2). The team page member rows use the 1.25px variant at a slightly smaller size; the account profile picture keeps 1.5px; every other avatar stays at 2px.
1 parent e8a2007 commit 654bfc3

4 files changed

Lines changed: 33 additions & 12 deletions

File tree

apps/webapp/app/assets/icons/AvatarCircleIcon.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,8 @@ export function AvatarCircleIcon({ className }: { className?: string }) {
2828
export function AvatarCircleIconThin({ className }: { className?: string }) {
2929
return <AvatarCircle className={className} strokeWidth={1.5} />;
3030
}
31+
32+
/** Thinnest 1.25px-stroke variant of {@link AvatarCircleIcon}. */
33+
export function AvatarCircleIconExtraThin({ className }: { className?: string }) {
34+
return <AvatarCircle className={className} strokeWidth={1.25} />;
35+
}
Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,48 @@
1-
import { AvatarCircleIcon, AvatarCircleIconThin } from "~/assets/icons/AvatarCircleIcon";
1+
import {
2+
AvatarCircleIcon,
3+
AvatarCircleIconExtraThin,
4+
AvatarCircleIconThin,
5+
} from "~/assets/icons/AvatarCircleIcon";
26
import { useOptionalUser } from "~/hooks/useUser";
37
import { cn } from "~/utils/cn";
48

9+
/** Stroke width (px) of the placeholder avatar icon shown when there is no photo. */
10+
type AvatarStrokeWidth = 1.25 | 1.5 | 2;
11+
12+
const PLACEHOLDER_BY_STROKE_WIDTH = {
13+
1.25: AvatarCircleIconExtraThin,
14+
1.5: AvatarCircleIconThin,
15+
2: AvatarCircleIcon,
16+
} as const;
17+
518
export function UserProfilePhoto({
619
className,
7-
thin = false,
20+
strokeWidth = 2,
821
}: {
922
className?: string;
10-
/** Use the thinner 1.5px-stroke placeholder icon (defaults to the 2px variant). */
11-
thin?: boolean;
23+
strokeWidth?: AvatarStrokeWidth;
1224
}) {
1325
const user = useOptionalUser();
1426
return (
15-
<UserAvatar avatarUrl={user?.avatarUrl} name={user?.name} className={className} thin={thin} />
27+
<UserAvatar
28+
avatarUrl={user?.avatarUrl}
29+
name={user?.name}
30+
className={className}
31+
strokeWidth={strokeWidth}
32+
/>
1633
);
1734
}
1835

1936
export function UserAvatar({
2037
avatarUrl,
2138
name,
2239
className,
23-
thin = false,
40+
strokeWidth = 2,
2441
}: {
2542
avatarUrl?: string | null;
2643
name?: string | null;
2744
className?: string;
28-
/** Use the thinner 1.5px-stroke placeholder icon (defaults to the 2px variant). */
29-
thin?: boolean;
45+
strokeWidth?: AvatarStrokeWidth;
3046
}) {
3147
if (avatarUrl) {
3248
return (
@@ -41,6 +57,6 @@ export function UserAvatar({
4157
);
4258
}
4359

44-
const PlaceholderIcon = thin ? AvatarCircleIconThin : AvatarCircleIcon;
60+
const PlaceholderIcon = PLACEHOLDER_BY_STROKE_WIDTH[strokeWidth];
4561
return <PlaceholderIcon className={cn("aspect-square text-text-dimmed", className)} />;
4662
}

apps/webapp/app/routes/_app.orgs.$organizationSlug.settings.team/route.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,8 @@ export default function Page() {
496496
<UserAvatar
497497
avatarUrl={member.user.avatarUrl}
498498
name={member.user.name}
499-
className="size-10"
500-
thin
499+
className="size-9"
500+
strokeWidth={1.25}
501501
/>
502502
<div className="flex flex-col gap-0.5">
503503
<Header3>

apps/webapp/app/routes/account._index/route.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export default function Page() {
150150
<Label>Profile picture</Label>
151151
</InputGroup>
152152
<div className="flex flex-none items-center">
153-
<UserProfilePhoto className="size-8" thin />
153+
<UserProfilePhoto className="size-8" strokeWidth={1.5} />
154154
</div>
155155
</div>
156156
</div>

0 commit comments

Comments
 (0)