Skip to content

Commit cb1f25f

Browse files
committed
fix: adjust course material card
1 parent 6667c7d commit cb1f25f

File tree

9 files changed

+48
-26
lines changed

9 files changed

+48
-26
lines changed

public/locales/bg/common.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@
122122
"communities.overview.challenge.learning.modules.included": "Включени образователни модули",
123123
"communities.overview.challenge.no.learning.modules": "Без включени образователни модули",
124124
"communities.overview.challenge.learning.title": "Следните учебни материали ще ви осигурят техническите умения, необходими за успешното справяне с предизвикателството.",
125+
"communities.overview.challenge.course": "КУРС",
126+
"communities.overview.challenge.course.learningModule": "{{count}} един учебен материал включен",
127+
"communities.overview.challenge.course.learningModules": "{{count}} единични учебни материали включени",
125128
"communities.overview.challenge.learning.start": "започнете сега",
126129
"communities.overview.challenge.team.setup.title": "Създайте вашия екип",
127130
"communities.overview.challenge.team.setup.description": "Изберете от 1 до 3 члена, които да се присъединят към предизвикателството.",

public/locales/en/common.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@
128128
"communities.overview.challenge.learning.modules.included": "Learning modules included",
129129
"communities.overview.challenge.no.learning.modules": "No learning modules included",
130130
"communities.overview.challenge.learning.title": "The following learning materials will equip you with the technical expertise required to successfully address the challenge.",
131+
"communities.overview.challenge.course": "COURSE",
132+
"communities.overview.challenge.course.learningModule": "{{count}} Single learning module included",
133+
"communities.overview.challenge.course.learningModules": "{{count}} Single learning modules included",
131134
"communities.overview.challenge.learning.start": "Start now",
132135
"communities.overview.challenge.team.setup.title": "Form your team",
133136
"communities.overview.challenge.team.setup.description": "Select from 1 to 3 members to join you in the challenge.",

public/locales/es/common.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@
127127
"communities.overview.challenge.learning.modules.included": "Módulos de aprendizaje incluidos",
128128
"communities.overview.challenge.no.learning.modules": "No se incluyen módulos de aprendizaje",
129129
"communities.overview.challenge.learning.title": "Los siguientes materiales de aprendizaje le proporcionarán la experiencia técnica necesaria para abordar con éxito el desafío.",
130+
"communities.overview.challenge.course": "CURSO",
131+
"communities.overview.challenge.course.learningModule": "{{count}} Módulo de aprendizaje único incluido",
132+
"communities.overview.challenge.course.learningModules": "{{count}} Módulos de aprendizaje únicos incluidos",
130133
"communities.overview.challenge.learning.start": "Comenzar ahora",
131134
"communities.overview.challenge.team.setup.title": "Forma tu equipo",
132135
"communities.overview.challenge.team.setup.description": "Selecciona de 1 a 3 miembros para que se unan a ti en el desafío.",

public/locales/hr/common.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@
175175
"communities.overview.challenge.learning.modules.included": "Uključeni moduli učenja",
176176
"communities.overview.challenge.no.learning.modules": "Nema uključenih modula učenja",
177177
"communities.overview.challenge.learning.title": "Sljedeći materijali za učenje opskrbit će vas tehničkim stručnostima potrebnim za uspješno rješavanje izazova.",
178+
"communities.overview.challenge.course": "TEČAJ",
179+
"communities.overview.challenge.course.learningModule": "{{count}} pojedini učeni materijal uključen",
180+
"communities.overview.challenge.course.learningModules": "{{count}} pojedinih učeni materijala uključeni",
178181
"communities.overview.challenge.learning.start": "Počnite sada",
179182
"communities.overview.challenge.team.setup.title": "Sastavite svoj tim",
180183
"communities.overview.challenge.team.setup.description": "Odaberite između 1 do 3 člana koji će vam se pridružiti u izazovu.",

src/components/badges/durationBadge.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,18 @@ import classNames from "classnames";
33
import { useRouter } from "next/router";
44
import React, { useMemo } from "react";
55

6-
export default function DurationBadge({ value, type = "gray" }: { value: number; type?: string }) {
6+
interface DuratetionBadgeProps{
7+
value:number;
8+
type?:string;
9+
}
10+
11+
/**
12+
* DurationBadge component
13+
*
14+
* @param {DuratetionBadgeProps} props - The props for the DurationBadge component.
15+
* @returns {JSX.Element} The Learning component JSX element.
16+
*/
17+
export default function DurationBadge({ value, type = "gray" }: DuratetionBadgeProps) {
718
const router = useRouter();
819
const duration = useMemo(() => {
920
return (value: number) => {
@@ -14,13 +25,13 @@ export default function DurationBadge({ value, type = "gray" }: { value: number;
1425
};
1526
}, [router.locale]);
1627
return (
17-
<span
18-
className={classNames("text-xxs uppercase font-semibold px-2 rounded-3xl inline-block text-gray-500", {
28+
<div
29+
className={classNames("text-xxs uppercase font-semibold px-2 rounded-3xl inline-block text-gray-500 text-nowrap", {
1930
"bg-gray-200": type === "gray",
2031
"border border-gray-200": type === "bordered",
2132
})}
2233
>
2334
{duration(value)}
24-
</span>
35+
</div>
2536
);
2637
}
File renamed without changes.

src/components/cards/challenge/Challenge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import ArrowButton from "@/components/ui/button/Arrow";
22
import { Community } from "@/types/community";
33
import { Challenge } from "@/types/course";
44
import Link from "next/link";
5-
import Badges from "../../badges/Badges";
65
import { useMemo } from "react";
76
import { useTranslation } from "next-i18next";
87
import Image from "next/image";
98
import RewardCertificate from "./RewardCertificate";
9+
import Badges from "@/components/badges";
1010

1111
/**
1212
* `ChallengeCard` is a function component that renders a card

src/components/cards/CourseCard.tsx renamed to src/components/cards/course/CourseMaterial.tsx

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,50 @@ import Link from "next/link";
44
import { useTranslation } from "next-i18next";
55
import { useSelector } from "react-redux";
66
import { IRootState } from "@/store";
7-
import Badges from "@/components/badges/Badges";
8-
import DurationBadge from "@/components/badges/durationBadge";
7+
import Badges from "@/components/badges";
8+
import DurationBadge from "@/components/badges/DurationBadge";
99

10-
/**
11-
* Props for the Learning component.
12-
*/
13-
interface LearningProps {
10+
interface CourseMaterialProps {
1411
title: string;
1512
description: string;
1613
link: string;
1714
level: number;
1815
learningModulesCount: number;
19-
duration: number
16+
duration: number;
2017
}
2118

2219
/**
23-
* Learning component.
20+
* CourseMaterialProps component.
2421
*
25-
* @param {LearningProps} props - The props for the Learning component.
26-
* @returns {JSX.Element} The Learning component JSX element.
22+
* @param {CourseMaterialProps} props - The props for the CourseMaterial component.
23+
* @returns {JSX.Element} The CourseMaterial component JSX element.
2724
*/
28-
export default function CourseCard({ title, description, link, level, learningModulesCount, duration}: LearningProps): JSX.Element {
25+
export default function CourseMaterial({ title, description, link, level, learningModulesCount, duration }: CourseMaterialProps): JSX.Element {
2926
const { t } = useTranslation();
30-
const colors = useSelector((state: IRootState)=>state.ui.colors);
27+
const colors = useSelector((state: IRootState) => state.ui.colors);
3128

3229
return (
3330
<div className="flex flex-col gap-3 relative p-6 divide-y sm:divide-y-0 sm:divide-x divide-gray-200 rounded-3xl group text-gray-700 sm:p-8 border-solid border border-gray-200">
3431
<div className="flex flex-col w-full">
35-
<div className="flex items-center justify-between mb-6">
32+
<div className="flex items-center justify-between mb-6 flex-wrap gap-2">
3633
<div className="flex gap-2 items-center">
3734
<div className="h-5.5 w-5.5 rounded-sm clip-polygon" style={{ backgroundColor: colors?.primary }} />
3835
<span className="capitalize font-semibold text-[#4B5563] text-sm">COURSE</span>
3936
</div>
40-
<div className="flex items-start gap-2">
41-
<Badges courseLevel={level} />
37+
<div className="flex items-center gap-2">
38+
<Badges courseLevel={level} className="!mb-0" />
4239
<DurationBadge value={duration} type="bordered" />
4340
</div>
4441
</div>
4542
<div className="flex flex-col gap-6">
4643
<div className="text-lg font-medium leading-normal text-gray-900">{title}</div>
4744
<div className="text-sm font-normal text-gray-700 max-w-xxs">{description}</div>
4845
{learningModulesCount && (
49-
<p className="text-sm pb-6 font-medium text-gray-400 border-b-2 border-gray-200 border-dotted">{`${learningModulesCount} Learning ${
50-
learningModulesCount === 1 ? "material" : "materials"
51-
} included`}</p>
46+
<p className="text-sm pb-6 font-medium text-gray-400 border-b-2 border-gray-200 border-dotted">
47+
{t(learningModulesCount === 1 ? "communities.overview.challenge.course.learningModule" : "communities.overview.challenge.course.learningModules", {
48+
count: learningModulesCount,
49+
})}
50+
</p>
5251
)}
5352
</div>
5453
<div className="bottom-0 mt-6">

src/components/sections/challenges/Learning.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import Accordion from "@/components/ui/accordion/Accordion";
33
import Section from "@/components/sections/communities/_partials/Section";
4-
import CourseCard from "@/components/cards/CourseCard";
4+
import CourseMaterial from "@/components/cards/course/CourseMaterial";
55
import RelatedLearningCard from "@/components/cards/challenge/_partials/RelatedLearning";
66
import { Course, LearningModule } from "@/types/course";
77
import { Community } from "@/types/community";
@@ -25,9 +25,9 @@ export default function Learning({ courses, learningModules, community }: { cour
2525
content={
2626
<>
2727
<div className="text-base font-normal text-slate-700 py-6">{t("communities.overview.challenge.learning.title")}</div>
28-
<div className={`grid grid-cols-1 gap-3 mb-3 ${courses.length > 1 && "md:grid-cols-2"}`}>
28+
<div className={`grid grid-cols-1 gap-3 mb-3 ${courses?.length > 1 && "md:grid-cols-2"}`}>
2929
{courses?.map((course) => (
30-
<CourseCard
30+
<CourseMaterial
3131
key={`learning-card-data-${course.id}`}
3232
title={course.name}
3333
description={course.description}

0 commit comments

Comments
 (0)