Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

💄 Update avatar component to use initials

Luke Vellad0b5b81ba7d3
diff --git a/apps/web/src/components/optimized-avatar-image.tsx b/apps/web/src/components/optimized-avatar-image.tsx
index 2a24b2def..d11789565 100644
--- a/apps/web/src/components/optimized-avatar-image.tsx
+++ b/apps/web/src/components/optimized-avatar-image.tsx
@@ -16,6 +16,11 @@ export function OptimizedAvatarImage({
className?: string;
}) {
const [isLoaded, setLoaded] = React.useState(false);
+ const initials = name
+ .split(" ")
+ .slice(0, 2)
+ .map((word) => word[0])
+ .join("");
return (
<Avatar className={cn("rounded-full", className)} size={size}>
{src ? (
@@ -36,7 +41,7 @@ export function OptimizedAvatarImage({
) : null}
{!src || !isLoaded ? (
<AvatarFallback seed={name} className={cn("shrink-0")}>
- {name?.[0]?.toUpperCase()}
+ {initials}
</AvatarFallback>
) : null}
</Avatar>
diff --git a/apps/web/src/components/poll/desktop-poll/participant-row-form.tsx b/apps/web/src/components/poll/desktop-poll/participant-row-form.tsx
index 0a8ffd563..ccea20f95 100644
--- a/apps/web/src/components/poll/desktop-poll/participant-row-form.tsx
+++ b/apps/web/src/components/poll/desktop-poll/participant-row-form.tsx
@@ -57,7 +57,7 @@ const ParticipantRowForm = ({
<tr className={cn("group", className)}>
<td
style={{ minWidth: 235, maxWidth: 235 }}
- className="sticky left-0 z-10 h-12 bg-background px-4"
+ className="sticky left-0 z-10 h-12 bg-background px-3"
>
<div className="flex items-center justify-between gap-x-2.5">
<Participant>
diff --git a/apps/web/src/components/poll/desktop-poll/participant-row.tsx b/apps/web/src/components/poll/desktop-poll/participant-row.tsx
index 40b62ac9a..b968b3e0e 100644
--- a/apps/web/src/components/poll/desktop-poll/participant-row.tsx
+++ b/apps/web/src/components/poll/desktop-poll/participant-row.tsx
@@ -48,9 +48,9 @@ export const ParticipantRowView: React.FunctionComponent<{
>
<td
style={{ minWidth: 235, maxWidth: 235 }}
- className="sticky left-0 z-10 h-12 bg-background px-4"
+ className="sticky left-0 z-10 h-12 bg-background px-3"
>
- <div className="flex max-w-full items-center justify-between gap-x-2">
+ <div className="flex max-w-full items-center justify-between gap-x-1">
<Participant>
<OptimizedAvatarImage size="sm" name={name} />
<ParticipantName>{name}</ParticipantName>
diff --git a/apps/web/src/components/poll/mobile-poll/poll-option.tsx b/apps/web/src/components/poll/mobile-poll/poll-option.tsx
index cf0d1f71d..71e97b3b6 100644
--- a/apps/web/src/components/poll/mobile-poll/poll-option.tsx
+++ b/apps/web/src/components/poll/mobile-poll/poll-option.tsx
@@ -59,7 +59,7 @@ const PollOptionVoteSummary: React.FunctionComponent<{ optionId: string }> = ({
<VoteIcon
type="yes"
size="sm"
- className="-translate-x-1.5 absolute bottom-full left-full translate-y-2.5 rounded-full bg-background"
+ className="-translate-x-1 absolute bottom-full left-full translate-y-2 rounded-full bg-background"
/>
</div>
<div className="truncate text-sm">{name}</div>
diff --git a/apps/web/src/components/poll/you-avatar.tsx b/apps/web/src/components/poll/you-avatar.tsx
index 901008467..233c449db 100644
--- a/apps/web/src/components/poll/you-avatar.tsx
+++ b/apps/web/src/components/poll/you-avatar.tsx
@@ -2,8 +2,8 @@ import { UserIcon } from "lucide-react";
export function YouAvatar() {
return (
- <div className="inline-flex size-5 items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs">
- <UserIcon className="size-3" />
+ <div className="inline-flex size-6 items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs">
+ <UserIcon className="size-4" />
</div>
);
}
diff --git a/packages/ui/src/avatar.tsx b/packages/ui/src/avatar.tsx
index 7398f326d..7b1948e41 100644
--- a/packages/ui/src/avatar.tsx
+++ b/packages/ui/src/avatar.tsx
@@ -7,10 +7,10 @@ import * as React from "react";
const avatarVariants = cva("relative flex shrink-0 overflow-hidden", {
variants: {
size: {
- xl: "size-12 rounded-lg text-xl",
- lg: "size-10 rounded-md text-lg",
- md: "size-8 rounded-md text-base",
- sm: "size-5 rounded-sm text-[10px]",
+ xl: "size-12 rounded-2xl text-lg",
+ lg: "size-10 rounded-xl text-base",
+ md: "size-8 rounded-lg text-sm",
+ sm: "size-6 rounded-md text-[10px]",
},
},
defaultVariants: {