Skip to content

Commit a2b55db

Browse files
committed
fix: spacing in challenge card and add course count
1 parent 423bc9b commit a2b55db

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

src/components/cards/challenge/Badges.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ export default function Badges({ challenge, className }: BadgeProps) {
2525
return setChallengeLevel("course.challenge.level-2");
2626
}, [challenge.level]);
2727

28+
if (!challenge?.level && !challenge?.isTeamChallenge) return <></>;
29+
2830
return (
29-
<div className={`uppercase flex flex-wrap gap-2 mb-6 ${className}`}>
31+
<div className={`uppercase flex flex-wrap gap-2 mb-4 ${className}`}>
3032
{challenge?.level && <Tag>{t(challengeLevel)}</Tag>}
3133
{challenge?.isTeamChallenge && <Tag type="light">{challenge?.isHackathon ? "Hackathon" : "Team"} challenge</Tag>}
3234
</div>

src/components/cards/challenge/Challenge.tsx

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,28 @@ export default function ChallengeCard({ data, community, isCourseEnd }: Challeng
2727
const link = `/communities/${community.slug}/challenges/${data.id}`;
2828
const expiresAt = useMemo(() => (data.expiresAt ? new Date(data.expiresAt).toLocaleDateString() : null), [data.expiresAt]);
2929
const reward = isCourseEnd ? data?.rewards?.find((reward) => reward.type === "SUBMISSION") : data?.reward;
30-
const learningModulesCount = data?.learningModules?.length || 0;
30+
const learningMaterialsCount = data?.learningModules?.length + data?.courses?.length || 0;
3131

3232
return (
33-
<div className="w-full justify-between- flex flex-col sm:flex-row md:flex-col lg:flex-row border-solid border border-gray-200 bg-gray-50 rounded-3xl mb-5 group text-gray-700">
34-
<div className="border-solid border-b border-gray-300 bg-white rounded-3xl sm:p-8 sm:pb-6 p-6 lg:w-2/3">
33+
<div className="w-full flex flex-col sm:flex-row md:flex-col lg:flex-row border-solid border border-gray-200 bg-gray-50 rounded-3xl mb-5 group text-gray-700">
34+
<div className="border-solid border-b border-r-0 sm:border-b-0 sm:border-r md:border-b md:border-r-0 lg:border-r lg:border-b-0 border-gray-300 bg-white rounded-3xl sm:p-8 sm:pb-6 p-6 lg:w-2/3">
3535
<div className="flex flex-col mb-1">
36-
<div className="lg:pr-20 lg:w-3/5-">
37-
<div className="text-gray-400 lg:w-2/3 text-sm font-normal mb-6 lg:mb-0">
38-
{expiresAt && (
39-
<>
36+
<div className="lg:pr-20">
37+
{expiresAt && (
38+
<div className="text-gray-400 lg:w-2/3 text-sm font-normal mb-4">
4039
<span>{t("communities.overview.challenge.deadline")}</span>
4140
<span className="font-medium pl-1">{expiresAt}</span>
42-
</>
43-
)}
44-
</div>
45-
<div className="text-lg text-gray-900 font-medium leading-normal mb-6">{data.name}</div>
46-
<Badges challenge={data} className="" />
47-
<div className="text-sm pb-2 text-gray-700">{data.description}</div>
41+
</div>
42+
)}
43+
<div className="text-lg text-gray-900 font-medium leading-normal mb-4">{data.name}</div>
44+
<Badges challenge={data} />
45+
<div className="text-sm text-gray-700">{data.description}</div>
4846
</div>
49-
<div className="divide-y-2 divide-gray-200 divide-dotted flex flex-col mt-3">
50-
<p className="pb-6">
51-
{learningModulesCount ? `${learningModulesCount} learning ${learningModulesCount === 1 ? "module" : "modules"} included` : "No learning modules included"}
52-
</p>
53-
<div className="lg:flex lg:flex-row flex-col justify-between pt-6 items-center">
47+
<div className="divide-y-2 divide-gray-200 divide-dotted flex flex-col mt-4">
48+
{learningMaterialsCount && (
49+
<p className="pb-5 text-sm font-medium text-gray-400">{`${learningMaterialsCount} Learning ${learningMaterialsCount === 1 ? "material" : "materials"} included`}</p>
50+
)}
51+
<div className="lg:flex lg:flex-row flex-col justify-between pt-5 items-center">
5452
<Link href={link}>
5553
<ArrowButton communityStyles={true} variant="outline-primary">
5654
{isCourseEnd ? t("communities.overview.challenge.take.challenge") : t("communities.overview.challenge.see.challenge")}
@@ -62,11 +60,11 @@ export default function ChallengeCard({ data, community, isCourseEnd }: Challeng
6260
</div>
6361
<div className="p-6">
6462
<div className={"mx-auto relative rounded-full mb-5 w-[147px] h-[184px]"}>
65-
<Image src={data?.certificateData?.icon} alt="achievement" fill />
63+
<Image src={data?.certificateData?.icon} alt="achievement" fill priority />
6664
</div>
6765
<div className="">
6866
<h1 className="font-bold text-gray-400 text-xs uppercase pb-2">{t("communities.overview.challenge.unlock.certificate")}</h1>
69-
<RewardCertificate rewards={data?.rewards}/>
67+
<RewardCertificate rewards={data?.rewards} />
7068
</div>
7169
{data?.isHackathon && <p className="py-2 border-t border-gray-200 text-sm">{t("communities.overview.challenge.participate", { token: reward?.token })}</p>}
7270
</div>

src/components/sections/communities/overview/Sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function Sidebar(): JSX.Element {
3232
const mainLink = hasCurrentCommunity ? `/communities/${currentCommunity.slug}` : "";
3333

3434
return (
35-
<div className="flex flex-col divide-y divide-solid divide-gray-100 w-full text-gray-700 space-y-6">
35+
<div className="flex flex-col md:divide-y divide-solid divide-gray-100 w-full text-gray-700 space-y-6">
3636
<Link href={mainLink}>
3737
<div className={isActive(mainLink) ? "" : "opacity-80"}>
3838
<div className="font-medium text-.5xl leading-snug">{t("communities.overview.challenges.title")}</div>

src/components/ui/Tag.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default function Tag({ rounded = true, type = "gray", value, children, ..
4444
);
4545
return (
4646
<div {...props} className={tagClassNames}>
47-
<span className="text-xs font-medium block leading-none">{value ? <span>{value}</span> : children}</span>
47+
<span className="text-xs font-medium block leading-none whitespace-nowrap">{value ? <span>{value}</span> : children}</span>
4848
</div>
4949
);
5050
}

0 commit comments

Comments
 (0)