Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

262-feat: colorful icons in upcoming courses #331

Merged
merged 4 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/widgets/courses-school/ui/CourseCard.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Course } from '@/app/types';
import { ArrowIcon } from '@/shared/icons';
import Image from '@/shared/ui/image';
import { LinkCustom } from '@/shared/ui/link-custom';

type addFields = {
buttonText: string;
icon: JSX.Element | null;
iconSrc: string;
};

type PropsType = Pick<Course, 'title' | 'language' | 'startDate' | 'detailsUrl'> & addFields;
Expand All @@ -15,11 +16,13 @@ export const CourseCard = ({
startDate,
detailsUrl,
buttonText,
icon,
iconSrc,
}: PropsType) => {
return (
<section className="course-card">
<figure className="icon-container">{icon}</figure>
<figure className="icon-container">
<Image src={iconSrc} alt={title} />
</figure>
<div className="course-info">
<p className="name">{title}</p>
<p className="date">{`${startDate} β€’ ${language[0].toUpperCase()}`}</p>
Expand Down
1 change: 1 addition & 0 deletions src/widgets/courses-school/ui/courses.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
img {
Wystov marked this conversation as resolved.
Show resolved Hide resolved
width: 48px;
height: 36px;
object-fit: contain;
}
}

Expand Down
8 changes: 2 additions & 6 deletions src/widgets/courses-school/ui/courses.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { CourseCard } from './CourseCard';
import { getCourseIcon } from '../lib/getCourseIcon';
import { IconsTitle } from '../lib/icons.data';
Wystov marked this conversation as resolved.
Show resolved Hide resolved
import { selectCourses } from '../lib/selectCourses';
import { ROUTES } from '@/app/const';

Expand All @@ -25,16 +23,14 @@ export const Courses = () => {
linkLabel = 'More';
}

const coursesContent = coursesData?.map(({ title, language, startDate, detailsUrl }) => {
const courseIcon = getCourseIcon(title as IconsTitle);
Wystov marked this conversation as resolved.
Show resolved Hide resolved

const coursesContent = coursesData?.map(({ title, language, startDate, detailsUrl, iconSrc }) => {
return (
<CourseCard
title={title}
language={language}
startDate={startDate}
detailsUrl={detailsUrl}
icon={courseIcon}
iconSrc={iconSrc}
buttonText={linkLabel}
key={title}
/>
Expand Down
Loading