Skip to content

Commit c807340

Browse files
committed
fix: update dark theme variant selector in CSS for consistency
1 parent 6aec05d commit c807340

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

src/components/UserInformationCard.tsx

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,26 @@ interface Props {
1515
const UserInformationCard: React.FC<Props> = ({ userId }) => {
1616
const { _t } = useTranslation();
1717
const session = useSession();
18-
const userQuery = useQuery({
18+
const query = useQuery({
1919
queryKey: ["user", userId],
2020
queryFn: () => userActions.getUserById(userId),
2121
});
22-
const profileData = {
23-
avatarUrl: userQuery.data?.profile_photo,
24-
name: userQuery.data?.name,
25-
title: userQuery.data?.designation,
26-
bio: userQuery.data?.bio,
27-
location: userQuery.data?.location,
28-
joinDate: userQuery.data?.created_at,
29-
education: userQuery.data?.education,
30-
};
3122

32-
if (userQuery.isFetching)
23+
if (query.isPending)
3324
return (
3425
<>
35-
<div className="h-80 animate-pulse bg-muted rounded-sm"></div>
26+
<div className="h-45 relative flex flex-col gap-2">
27+
<div className="flex gap-4 items-center">
28+
<div className="size-[56px] bg-gray-200 dark:bg-gray-800 animate-pulse flex-none rounded-full" />
29+
<div className="flex-1 flex flex-col gap-2">
30+
<div className="h-4 bg-gray-200 dark:bg-gray-800 animate-pulse" />
31+
<div className="h-3 bg-gray-200 dark:bg-gray-800 w-8/12 animate-pulse" />
32+
</div>
33+
</div>
34+
35+
<div className="h-3 bg-gray-200 dark:bg-gray-800 animate-pulse" />
36+
<div className="h-5 bg-gray-200 dark:bg-gray-800 animate-pulse" />
37+
</div>
3638
</>
3739
);
3840

@@ -43,8 +45,8 @@ const UserInformationCard: React.FC<Props> = ({ userId }) => {
4345
{/* Avatar */}
4446
<div className="relative mr-4">
4547
<Image
46-
src={profileData.avatarUrl ?? ""}
47-
alt={profileData.name ?? ""}
48+
src={query.data?.profile_photo ?? ""}
49+
alt={query.data?.name ?? ""}
4850
width={56}
4951
height={56}
5052
className="w-14 h-14 rounded-full object-cover border-2 border-white/90 shadow-md"
@@ -53,8 +55,10 @@ const UserInformationCard: React.FC<Props> = ({ userId }) => {
5355

5456
{/* Name */}
5557
<div>
56-
<h2 className="text-xl font-bold">{profileData.name}</h2>
57-
<p className="text-sm text-muted-foreground">kingrayhan</p>
58+
<h2 className="text-xl font-bold">{query.data?.name}</h2>
59+
<p className="text-sm text-muted-foreground">
60+
{query.data?.username}
61+
</p>
5862
</div>
5963
</div>
6064

@@ -76,26 +80,26 @@ const UserInformationCard: React.FC<Props> = ({ userId }) => {
7680

7781
{/* Bio */}
7882
<p className="text-sm leading-relaxed text-muted-foreground">
79-
{profileData.bio}
83+
{query.data?.bio}
8084
</p>
8185

8286
{/* Profile Details */}
8387
<div className="space-y-3">
8488
{/* Location */}
85-
{profileData.location && (
89+
{query.data?.location && (
8690
<div className="flex flex-col">
8791
<p className="font-semibold">{_t("Location")}</p>
8892
<p className="text-sm text-muted-foreground">
89-
{profileData.location}
93+
{query.data?.location}
9094
</p>
9195
</div>
9296
)}
9397

94-
{profileData.education && (
98+
{query.data?.education && (
9599
<div className="flex flex-col">
96100
<p className="font-semibold">{_t("Education")}</p>
97101
<p className="text-sm text-muted-foreground">
98-
{profileData.education}
102+
{query.data?.education}
99103
</p>
100104
</div>
101105
)}

src/styles/app.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
@import "tw-animate-css";
88
@plugin "@tailwindcss/typography";
99

10-
@custom-variant dark (&:is([color-theme="dark"] *));
10+
@custom-variant dark (&:is([data-theme="dark"] *));
1111

1212
@theme inline {
1313
--color-background: var(--background);

0 commit comments

Comments
 (0)