Skip to content

Commit

Permalink
Try a different skill presentation option
Browse files Browse the repository at this point in the history
  • Loading branch information
zoul committed Sep 25, 2024
1 parent b539c7f commit 93e21eb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
27 changes: 25 additions & 2 deletions app/people/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import {
UserProfileCard,
UserProfileContainer,
} from "~/components/UserProfileCard";
import { compareByName, getAllUserProfiles } from "~/src/data/user-profile";
import {
compareByName,
getAllUserProfiles,
type UserProfile,
} from "~/src/data/user-profile";
import { strip } from "~/src/utils";

/** Refresh data every 5 minutes */
Expand Down Expand Up @@ -34,12 +38,31 @@ async function Page() {
<UserProfileCard
key={profile.id}
profile={profile}
label={profile.tags}
label={<Skills profile={profile} />}
/>
))}
</UserProfileContainer>
</main>
);
}

const Skills = ({ profile }: { profile: UserProfile }) => (
<ul className="text-balance">
{profile.tags.split(/;\s*/).map((tag) => (
<li key={tag} className="inline">
{tag}
<span
className="bg-center bg-no-repeat tracking-[0.8em]"
style={{ backgroundImage: `url(${bulletImage})` }}
>
{" "}
</span>
</li>
))}
</ul>
);

const bulletImage =
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwAAADsABataJCQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMkMEa+wAAAAnSURBVBhXY/Dz89MA4sNA/B9Ka4AEYQIwfBgkiCwAxjhVopnppwEApxQqhnyQ+VkAAAAASUVORK5CYII=";

export default Page;
5 changes: 3 additions & 2 deletions components/UserProfileCard.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { type ReactNode } from "react";
import Image from "next/image";
import Link from "next/link";

Expand All @@ -10,7 +11,7 @@ import { Route } from "~/src/routing";
export type Props = {
profile: Pick<UserProfile, "name" | "avatarUrl" | "id"> &
Partial<Pick<UserProfile, "roles">>;
label?: string;
label?: ReactNode;
};

export const UserProfileCard = ({ profile, label }: Props) => (
Expand Down Expand Up @@ -49,7 +50,7 @@ export const UserProfileCard = ({ profile, label }: Props) => (
</div>
<div className="flex flex-col gap-2 self-center">
<h3 className="typo-subtitle">{profile.name}</h3>
{label && <p className="typo-caption leading-relaxed">{label}</p>}
{label && <div className="typo-caption leading-relaxed">{label}</div>}
</div>
</Link>
);
Expand Down

0 comments on commit 93e21eb

Please sign in to comment.