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

774-feat: Mentorship post release updates: Course card design update #781

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
4 changes: 4 additions & 0 deletions src/core/styles/_constants.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,7 @@ $opacity-20: 0.2;
$opacity-10: 0.1;
$opacity-8: 0.08;
$opacity-0: 0;

// Easing functions
$ease-standard-accelerate: cubic-bezier(0.3, 0, 1, 1);
$ease-emphasize-decelerate: cubic-bezier(0, 0, 0, 1);
16 changes: 8 additions & 8 deletions src/core/styles/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,24 @@
content: '';

position: absolute;
z-index: 1;
right: -152px;
bottom: -176px;

display: block;

width: 256px;
height: 248px;
width: 310px;
height: 300px;
border-radius: 100%;

opacity: 0.5;
background-color: $bg-color;
filter: blur(32px);
border-radius: 100%;

transition: all 200ms $ease-standard-accelerate;

@if $isHovered {
right: -130px;
bottom: -160px;
width: 279px;
height: 270px;
translate: -22px -16px;
scale: 1.25;
transition: all 500ms 100ms $ease-emphasize-decelerate;
}
}
89 changes: 73 additions & 16 deletions src/entities/course/ui/course-card/course-card.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,110 @@

@extend %transition-all;

position: relative;

display: flex;
flex-direction: column;

width: 380px;
min-width: 100px;
height: 100%;

border-radius: 12px;

&::before {
content: '';

position: absolute;
z-index: -1;
inset: 0;

border-radius: inherit;

opacity: 0;
background-color: hsla(from $color-black h s l/ $opacity-20);
backdrop-filter: blur(6px);

transition: ease-in 200ms;
}

.card-header {
position: relative;

overflow: hidden;
display: flex;
gap: 24px;
gap: 16px;
align-items: center;

height: 100%;
min-height: 112px;
padding: 0 24px;
padding: 36px 32px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

Review padding values.

Large padding values (32px, 36px) contribute to increased card size. Consider reducing to maintain compact design:

-    padding: 36px 32px;
+    padding: 24px 24px;

-    padding: 32px;
+    padding: 24px;

Also applies to: 64-64

border-radius: 12px 12px 0 0;

background-color: $color-purple-50;
border: solid $color-gray-200;
border-width: 1px 1px 0 1px;
border-radius: 12px 12px 0 0;

&::after {
@extend %transition-all;

@include card-corner-accent($accent-color);
}

img {
flex-shrink: 0;
width: 60px;
height: 54px;
width: auto;
height: 100px;
object-fit: contain;
}

@include media-laptop-medium {
min-height: 215px;
}

@include media-tablet-large {
min-height: unset;
}

@include media-mobile-landscape {
min-height: 200px;
padding: 24px;
}
}

.course-info {
display: flex;
gap: 16px;
align-items: center;
justify-content: space-between;

padding: 24px;

background-color: hsla(from $color-gray-100 h s l/ $opacity-20);
border: solid $color-gray-200;
padding: 32px;
border-color: $color-gray-200;
border-style: solid;
border-width: 0 1px 1px 1px;
border-radius: 0 0 12px 12px;

background-color: $color-white;

@include media-laptop-medium {
flex-direction: column;
align-items: flex-start;
}

@include media-tablet-large {
flex-direction: row;
align-items: center;
}

@include media-mobile-landscape {
flex-direction: column;
align-items: flex-start;
padding: 24px;
}
}

.course-title {
z-index: 2;
}

.course-link {
@include media-mobile-landscape {
width: 100%;
}
}

@include media-hover {
Expand All @@ -70,7 +123,11 @@
@include media-hover {
.course-card {
&:hover {
box-shadow: 0 4px 16px 0 hsla(from $color-black h s l/ $opacity-20);
&::before {
opacity: 1;
filter: blur(10px);
transition: ease-out 200ms;
}
}
}
}
5 changes: 3 additions & 2 deletions src/entities/course/ui/course-card/course-card.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ describe('CourseCard', () => {
});

it('renders the course card content correctly', () => {
const language = mockProps.language === 'ru' ? 'Russian' : 'English';

expect(screen.getByText(mockProps.title)).toBeVisible();
expect(screen.getByText(`${mockProps.startDate}`)).toBeVisible();
expect(screen.getByText(mockProps.language)).toBeVisible();
expect(screen.getByText(`${mockProps.mode}`)).toBeVisible();
expect(screen.getByText(language)).toBeVisible();
expect(screen.getByRole('link')).toHaveAttribute('href', mockProps.detailsUrl);
});

Expand Down
7 changes: 3 additions & 4 deletions src/entities/course/ui/course-card/course-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const CourseCard = ({
startDate,
registrationEndDate,
detailsUrl,
mode,
language,
backgroundStyle,
className,
Expand All @@ -45,18 +44,18 @@ export const CourseCard = ({
<article className={cx('course-card', className)} data-testid="course-card">
<div className={cx('card-header')} style={cardStyle} data-testid="card-header">
<Image src={iconSrc} alt={title} />
<Subtitle fontSize="small">{title}</Subtitle>
<Subtitle className={cx('course-title')} fontSize="large">{title}</Subtitle>
</div>
<div className={cx('course-info')}>
<DateLang
startDate={startDate}
registrationEndDate={registrationEndDate}
language={language}
mode={mode}
/>
<LinkCustom
className={cx('course-link')}
href={detailsUrl}
variant="rounded"
variant="secondary"
aria-label="View course details"
data-testid="course-link"
>
Expand Down
4 changes: 3 additions & 1 deletion src/shared/assets/icons/mic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/shared/assets/icons/note-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 3 additions & 4 deletions src/shared/assets/svg/arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions src/shared/icons/arrow-icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ import Image from 'next/image';

import arrow from '@/shared/assets/svg/arrow.svg';

export const ArrowIcon = ({ size = 24 }: { size?: number }) => {
export const ArrowIcon = () => {
return (
<Image
src={arrow}
alt="arrow icon"
height={size}
width={size}
data-testid="arrow-icon"
/>
);
Expand Down
13 changes: 6 additions & 7 deletions src/shared/ui/date-lang/date-lang.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,22 @@
.date,
.additional-info {
display: flex;
gap: 4px;
gap: 8px;
align-items: center;
justify-content: flex-start;

margin: 0;

font-size: 14px;
color: $color-gray-600;
}

.icon {
width: 16px;
height: 16px;
.bold {
font-weight: 700;
}

.language {
text-transform: uppercase;
.icon {
width: 24px;
height: 24px;
}

.mode {
Expand Down
10 changes: 1 addition & 9 deletions src/shared/ui/date-lang/date-lang.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,13 @@ describe('DateLang', () => {
startDate={startDate}
registrationEndDate={registrationEndDate}
language="en"
mode=""
/>,
);
expect(screen.getByText(`${startDate}`)).toBeInTheDocument();
});

it('renders the mode correctly', () => {
const mode = 'Online';

render(<DateLang startDate="" registrationEndDate="" language="en" mode={mode} />);
expect(screen.getByText(`${mode}`)).toBeInTheDocument();
});

it('displays the correct note and microphone icons', () => {
render(<DateLang startDate="" registrationEndDate="" language="en" mode="" />);
render(<DateLang startDate="" registrationEndDate="" language="en" />);
expect(screen.getByAltText('note-icon')).toHaveAttribute('src', noteIcon.src);
expect(screen.getByRole('img', { name: 'microphone-icon' })).toHaveAttribute(
'src',
Expand Down
10 changes: 4 additions & 6 deletions src/shared/ui/date-lang/date-lang.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const cx = classNames.bind(styles);
interface DateLangProps {
startDate: string;
registrationEndDate: string;
mode: string;
language: Language;
withMargin?: boolean;
}
Expand All @@ -22,21 +21,20 @@ export const DateLang = ({
startDate,
registrationEndDate,
language,
mode,
withMargin,
}: DateLangProps) => {
const courseLanguage = language === 'ru' ? 'Russian' : 'English';

return (
<section className={cx('info', { margin: withMargin })}>
<p className={cx('date')}>
<Image className={cx('icon')} src={noteIcon} alt="note-icon" />
<span>Start:</span>
<span className={cx('bold')}>Course starts on:</span>
<DateStart courseStartDate={startDate} registrationEndDate={registrationEndDate} />
</p>
<p className={cx('additional-info')}>
<Image className={cx('icon')} src={micIcon} alt="microphone-icon" />
<span className={cx('language')}>{language}</span>
<span>β€’</span>
<span className={cx('mode')}>{mode}</span>
<span>{courseLanguage}</span>
</p>
</section>
);
Expand Down
22 changes: 16 additions & 6 deletions src/shared/ui/link-custom/link-custom.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@

.secondary {
width: max-content;
padding: 16px 24px;
border: 2px solid $color-black;
padding: 12px 24px;
border: 1px solid $color-black;

font-size: 18px;
color: $color-black;

img {
filter: invert(100%);
.icon-wrapper {
display: flex;
align-items: center;
justify-content: center;

min-width: 24px;
min-height: 24px;
}

&:hover {
Expand Down Expand Up @@ -64,8 +69,13 @@

background-color: #eee;

img {
filter: invert(100%);
.icon-wrapper {
display: flex;
align-items: center;
justify-content: center;

min-width: 16px;
min-height: 16px;
}

&:hover {
Expand Down
Loading