From 68670119da83d25783959d4f27e73a2665b9e920 Mon Sep 17 00:00:00 2001 From: OGBONNA SUNDAY <62995161+OgDev-01@users.noreply.github.com> Date: Fri, 23 Jun 2023 14:33:22 +0100 Subject: [PATCH] feat: add `UserCard` component to storybook design system (#1295) --- components/atoms/UserCard/user-card.tsx | 58 +++++++++++++++++++++++++ stories/atoms/user-card.stories.tsx | 34 +++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 components/atoms/UserCard/user-card.tsx create mode 100644 stories/atoms/user-card.stories.tsx diff --git a/components/atoms/UserCard/user-card.tsx b/components/atoms/UserCard/user-card.tsx new file mode 100644 index 0000000000..73f03b4a8e --- /dev/null +++ b/components/atoms/UserCard/user-card.tsx @@ -0,0 +1,58 @@ +import { getAvatarByUsername } from "lib/utils/github"; +import Image from "next/image"; +import React from "react"; + +type MetaObj = { + name: "Followers" | "Following" | "Highlights"; + count: number; +}; +interface UserCardProps { + username: string; + meta: MetaObj[]; + name: string; +} +const UserCard = ({ username, name, meta }: UserCardProps) => { + const avatarUrl = getAvatarByUsername(username); + + return ( +
{`@${username}`}
+{name}
+ {count > 0 ? count : "-"} +Followers
+ {followersCount > 0 ? followersCount : "-"} +Following
+ {followingCount > 0 ? followingCount : "-"} +Highlights
+ {highlightsCount > 0 ? highlightsCount : "-"} +