[resumes][feat] fix resume badge UI (#400)

* [resumes][feat] update badge icon

* [resumes][refactor] update resume badge names

* [resumes][refactor] update to title

* [resumes][fix] disable horizontal scroll in comments
pull/402/head
Keane Chan 2 years ago committed by GitHub
parent 0311ee3e6a
commit 707161380f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,7 +2,7 @@ type Props = Readonly<{
className: string;
}>;
export default function SilverReviewerBadgeIcon({ className }: Props) {
export default function ResumeBadgeDetectiveIcon({ className }: Props) {
return (
<svg
aria-hidden="true"

@ -2,7 +2,7 @@ type Props = Readonly<{
className: string;
}>;
export default function BronzeReviewerBadgeIcon({ className }: Props) {
export default function ResumeBadgeEagleIcon({ className }: Props) {
return (
<svg
aria-hidden="true"

@ -2,7 +2,7 @@ type Props = Readonly<{
className: string;
}>;
export default function GoldReviewerBadgeIcon({ className }: Props) {
export default function ResumeBadgeSuperheroIcon({ className }: Props) {
return (
<svg
aria-hidden="true"

@ -3,29 +3,28 @@ import type { BadgeIcon } from './resumeBadgeConstants';
type Props = Readonly<{
description: string;
icon: BadgeIcon;
toolTip: string;
title: string;
}>;
export default function ResumeUserBadge({
description,
icon: Icon,
toolTip,
title,
}: Props) {
return (
<div className="group">
<div className="group flex items-center justify-center">
<div
className="absolute left-16 -top-1 hidden w-64 -translate-y-full flex-col justify-center
rounded-lg bg-slate-50 px-2 py-2 text-center shadow-md
after:absolute after:left-1/2 after:top-[100%]
after:-translate-x-1/2 after:border-8 after:border-x-transparent
after:border-b-transparent after:border-t-slate-50
after:content-['']
className="absolute -top-0 hidden w-64 -translate-y-full flex-col
justify-center gap-1 rounded-lg bg-slate-100 px-2 py-2 text-center drop-shadow-xl
after:absolute after:left-1/2 after:top-[100%] after:-translate-x-1/2
after:border-8 after:border-x-transparent after:border-b-transparent
after:border-t-slate-100 after:drop-shadow-lg after:content-['']
group-hover:flex">
<Icon className="text-center" />
<p className="text-lg font-medium">{toolTip}</p>
<Icon className="self-center" />
<p className="font-medium">{title}</p>
<p className="text-sm font-light">{description}</p>
</div>
<Icon className="h-3 w-3" />
<Icon className="h-4 w-4" />
</div>
);
}

@ -20,17 +20,17 @@ export default function ResumeUserBadges({ userId }: Props) {
};
return (
<>
<div className="flex items-center justify-center gap-1">
{RESUME_USER_BADGES.filter((badge) => badge.isValid(payload)).map(
(badge) => (
<ResumeUserBadge
key={badge.id}
description={badge.description}
icon={badge.icon}
toolTip={badge.toolTip}
title={badge.title}
/>
),
)}
</>
</div>
);
}

@ -1,12 +1,12 @@
import BronzeReviewerBadgeIcon from '../badgeIcons/reviewer/BronzeReviewerBadgeIcon';
import GoldReviewerBadgeIcon from '../badgeIcons/reviewer/GoldReviewerBadgeIcon';
import SilverReviewerBadgeIcon from '../badgeIcons/reviewer/SilverReviewerBadgeIcon';
import ResumeBadgeDetectiveIcon from '../badgeIcons/reviewer/ResumeBadgeDetectiveIcon';
import ResumeBadgeEagleIcon from '../badgeIcons/reviewer/ResumeBadgeEagleIcon';
import ResumeBadgeSuperheroIcon from '../badgeIcons/reviewer/ResumeBadgeSuperheroIcon';
export type BadgeIcon = (
props: React.ComponentProps<
| typeof BronzeReviewerBadgeIcon
| typeof GoldReviewerBadgeIcon
| typeof SilverReviewerBadgeIcon
| typeof ResumeBadgeDetectiveIcon
| typeof ResumeBadgeEagleIcon
| typeof ResumeBadgeSuperheroIcon
>,
) => JSX.Element;
@ -15,7 +15,7 @@ export type BadgeInfo = {
icon: BadgeIcon;
id: string;
isValid: (payload: BadgePayload) => boolean;
toolTip: string;
title: string;
};
// TODO: Add other badges in
@ -23,35 +23,35 @@ export type BadgePayload = {
reviewedResumesCount: number;
};
const GOLD_TIER = 20;
const SILVER_TIER = 10;
const BRONZE_TIER = 5;
const TIER_THREE = 20;
const TIER_TWO = 10;
const TIER_ONE = 5;
export const RESUME_USER_BADGES: Array<BadgeInfo> = [
{
description: `User has reviewed over ${GOLD_TIER} resumes`,
icon: GoldReviewerBadgeIcon,
description: `Reviewed over ${TIER_ONE} resumes`,
icon: ResumeBadgeSuperheroIcon,
id: 'Superhero',
isValid: (payload: BadgePayload) =>
payload.reviewedResumesCount >= GOLD_TIER,
toolTip: 'True saviour of the people',
payload.reviewedResumesCount >= TIER_THREE,
title: 'True saviour of the people',
},
{
description: `User has reviewed over ${SILVER_TIER} resumes`,
icon: SilverReviewerBadgeIcon,
description: `Reviewed over ${TIER_TWO} resumes`,
icon: ResumeBadgeDetectiveIcon,
id: 'Detective',
isValid: (payload: BadgePayload) =>
payload.reviewedResumesCount >= SILVER_TIER &&
payload.reviewedResumesCount < GOLD_TIER,
toolTip: 'Keen eye for details like a private eye',
payload.reviewedResumesCount >= TIER_TWO &&
payload.reviewedResumesCount < TIER_THREE,
title: 'Keen eye for details like a private eye',
},
{
description: `User has reviewed over ${BRONZE_TIER} resumes`,
icon: BronzeReviewerBadgeIcon,
description: `Reviewed over ${TIER_THREE} resumes`,
icon: ResumeBadgeEagleIcon,
id: 'Eagle',
isValid: (payload: BadgePayload) =>
payload.reviewedResumesCount >= BRONZE_TIER &&
payload.reviewedResumesCount < SILVER_TIER,
toolTip: 'As sharp as an eagle',
payload.reviewedResumesCount >= TIER_ONE &&
payload.reviewedResumesCount < TIER_TWO,
title: 'As sharp as an eagle',
},
];

@ -73,7 +73,7 @@ export default function ResumeCommentsList({
<Spinner display="block" size="lg" />
</div>
) : (
<div className="m-2 flow-root h-[calc(100vh-20rem)] w-full flex-col space-y-4 overflow-y-auto">
<div className="m-2 flow-root h-[calc(100vh-20rem)] w-full flex-col space-y-4 overflow-y-auto overflow-x-hidden">
{RESUME_COMMENTS_SECTIONS.map(({ label, value }) => {
const comments = commentsQuery.data
? commentsQuery.data.filter((comment: ResumeComment) => {

Loading…
Cancel
Save