From 7f5ec3bcfd486df430cd9f56ffbfbe1c4e2a323c Mon Sep 17 00:00:00 2001 From: Bohdan Shcherbyna Date: Mon, 16 Dec 2024 12:51:38 +0200 Subject: [PATCH 1/6] refactor: 694 - move files to ui folder --- src/widgets/general/index.ts | 2 +- src/widgets/general/{ => ui}/general.scss | 0 src/widgets/general/{ => ui}/general.test.tsx | 0 src/widgets/general/{ => ui}/general.tsx | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename src/widgets/general/{ => ui}/general.scss (100%) rename src/widgets/general/{ => ui}/general.test.tsx (100%) rename src/widgets/general/{ => ui}/general.tsx (100%) diff --git a/src/widgets/general/index.ts b/src/widgets/general/index.ts index 7c24a8986..4eda1c41d 100644 --- a/src/widgets/general/index.ts +++ b/src/widgets/general/index.ts @@ -1 +1 @@ -export { General } from './general'; +export { General } from './ui/general'; diff --git a/src/widgets/general/general.scss b/src/widgets/general/ui/general.scss similarity index 100% rename from src/widgets/general/general.scss rename to src/widgets/general/ui/general.scss diff --git a/src/widgets/general/general.test.tsx b/src/widgets/general/ui/general.test.tsx similarity index 100% rename from src/widgets/general/general.test.tsx rename to src/widgets/general/ui/general.test.tsx diff --git a/src/widgets/general/general.tsx b/src/widgets/general/ui/general.tsx similarity index 100% rename from src/widgets/general/general.tsx rename to src/widgets/general/ui/general.tsx From 8b7d4795c32252736518cbf75dbef2d56ce9668e Mon Sep 17 00:00:00 2001 From: Bohdan Shcherbyna Date: Mon, 16 Dec 2024 12:54:25 +0200 Subject: [PATCH 2/6] refactor: 694 - change scss to use modules --- .../ui/{general.scss => general.module.scss} | 10 +++---- src/widgets/general/ui/general.tsx | 27 ++++++++++--------- 2 files changed, 20 insertions(+), 17 deletions(-) rename src/widgets/general/ui/{general.scss => general.module.scss} (91%) diff --git a/src/widgets/general/ui/general.scss b/src/widgets/general/ui/general.module.scss similarity index 91% rename from src/widgets/general/ui/general.scss rename to src/widgets/general/ui/general.module.scss index 0a2b2040e..0957bc6e3 100644 --- a/src/widgets/general/ui/general.scss +++ b/src/widgets/general/ui/general.module.scss @@ -1,14 +1,14 @@ .general { - & .content { + .content { padding: 40px 120px; - & .title { + .title { margin-bottom: 10px; font-size: 36px; line-height: 44px; } - & .general-info { + .general-info { display: flex; gap: 24px; align-items: flex-start; @@ -19,7 +19,7 @@ & > div { max-width: 380px; - & .title { + .title { margin-top: 0; font-size: 28px; color: $color-gray-600; @@ -35,7 +35,7 @@ } } - & .description { + .description { margin: 0; padding: 0; font-size: 18px; diff --git a/src/widgets/general/ui/general.tsx b/src/widgets/general/ui/general.tsx index 257d14996..9a32a32d9 100644 --- a/src/widgets/general/ui/general.tsx +++ b/src/widgets/general/ui/general.tsx @@ -1,7 +1,10 @@ +import classNames from 'classnames/bind'; import { List } from '@/shared/ui/list'; import { WidgetTitle } from '@/shared/ui/widget-title'; -import './general.scss'; +import styles from './general.module.scss'; + +const cx = classNames.bind(styles); const materials = [ [ @@ -18,24 +21,24 @@ const materials = [ export const General = () => { return ( -
-
+
+
General -
-
-

Materials

+
+
+

Materials

-
-

Certificate

-

+

+

Certificate

+

A certificate of successful completion of the course is issued to all who have passed the two stages of training.

-
-

Chat

-

+

+

Chat

+

Open chat for applicants and students on Discord, Telegram and more.

From 9103667ee905d73196b0853f44bfa5605d3160e4 Mon Sep 17 00:00:00 2001 From: Bohdan Shcherbyna Date: Mon, 16 Dec 2024 13:55:45 +0200 Subject: [PATCH 3/6] refactor: 694 - remove unnecessary styles --- src/widgets/general/ui/general.module.scss | 76 ++++++---------------- src/widgets/general/ui/general.tsx | 44 +++++++------ 2 files changed, 42 insertions(+), 78 deletions(-) diff --git a/src/widgets/general/ui/general.module.scss b/src/widgets/general/ui/general.module.scss index 0957bc6e3..344c89359 100644 --- a/src/widgets/general/ui/general.module.scss +++ b/src/widgets/general/ui/general.module.scss @@ -1,67 +1,29 @@ .general { - .content { - padding: 40px 120px; + display: grid; + grid-template-columns: repeat(3, 1fr); + grid-template-rows: repeat(2, max-content); + column-gap: 24px; - .title { - margin-bottom: 10px; - font-size: 36px; - line-height: 44px; - } - - .general-info { - display: flex; - gap: 24px; - align-items: flex-start; - justify-content: space-between; - - color: $color-gray-600; - - & > div { - max-width: 380px; - - .title { - margin-top: 0; - font-size: 28px; - color: $color-gray-600; - - @include media-laptop { - font-size: 22px; - line-height: 36px; - } - - @include media-tablet { - font-size: 28px; - line-height: 36px; - } - } + .title { + grid-column: 1 / -1; + } - .description { - margin: 0; - padding: 0; - font-size: 18px; - line-height: 28px; - } - } + .info-block { + display: flex; + flex-direction: column; + gap: 16px; - .materials { - ul { - font-size: 18px; - line-height: 28px; - } - } + max-width: 380px; - @include media-laptop { - flex-direction: column; - } - } + color: $color-gray-600; + } - @include media-laptop { - width: 100%; - padding: 40px 40px 0; - } + @include media-tablet { + grid-template-columns: 1fr; + column-gap: 0; - @include media-tablet { - padding: 40px 16px; + .info-block { + margin-top: 24px; } } } diff --git a/src/widgets/general/ui/general.tsx b/src/widgets/general/ui/general.tsx index 9a32a32d9..340b63a82 100644 --- a/src/widgets/general/ui/general.tsx +++ b/src/widgets/general/ui/general.tsx @@ -1,5 +1,7 @@ import classNames from 'classnames/bind'; import { List } from '@/shared/ui/list'; +import { Paragraph } from '@/shared/ui/paragraph'; +import { Subtitle } from '@/shared/ui/subtitle'; import { WidgetTitle } from '@/shared/ui/widget-title'; import styles from './general.module.scss'; @@ -21,28 +23,28 @@ const materials = [ export const General = () => { return ( -
+
- General -
-
-

Materials

- -
-
-

Certificate

-

- A certificate of successful completion of the course is issued to all who have passed - the two stages of training. -

-
-
-

Chat

-

- Open chat for applicants and students on Discord, Telegram and more. -

-
-
+ + General + +
+ Materials + +
+
+ Certificate + + A certificate of successful completion of the course is issued to all who have passed + the two stages of training. + +
+
+ Chat + + Open chat for applicants and students on Discord, Telegram and more. + +
); From 45313d051f15f669157188578ae437b5d4915dbb Mon Sep 17 00:00:00 2001 From: Bohdan Shcherbyna Date: Mon, 16 Dec 2024 14:01:37 +0200 Subject: [PATCH 4/6] refactor: 694 - move data to dev-data --- dev-data/general.data.ts | 12 ++++++++++++ dev-data/index.ts | 1 + src/widgets/general/ui/general.tsx | 16 ++-------------- 3 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 dev-data/general.data.ts diff --git a/dev-data/general.data.ts b/dev-data/general.data.ts new file mode 100644 index 000000000..3d9f7f98b --- /dev/null +++ b/dev-data/general.data.ts @@ -0,0 +1,12 @@ +export const generalMaterials = [ + [ + { + id: 0, + text: '', + title: 'School documentation', + link: 'https://docs.rs.school', + }, + ], + 'All materials are publicly available on YouTube and GitHub', + 'We also suggest that you familiarize yourself with the summary of the first stage of training.', +]; diff --git a/dev-data/index.ts b/dev-data/index.ts index e9cfd3b86..53e0c1e80 100644 --- a/dev-data/index.ts +++ b/dev-data/index.ts @@ -43,6 +43,7 @@ export { courses } from './courses.data'; export { coursesPath } from './courses-path.data'; export { events } from './events.data'; export { faqData } from './faq.data'; +export { generalMaterials } from './general.data'; export { heroPageData } from './hero-page.data'; export { javaScriptEn } from './javascript-en.data'; export { javaScriptRu } from './javascript-ru.data'; diff --git a/src/widgets/general/ui/general.tsx b/src/widgets/general/ui/general.tsx index 340b63a82..abc238992 100644 --- a/src/widgets/general/ui/general.tsx +++ b/src/widgets/general/ui/general.tsx @@ -3,24 +3,12 @@ import { List } from '@/shared/ui/list'; import { Paragraph } from '@/shared/ui/paragraph'; import { Subtitle } from '@/shared/ui/subtitle'; import { WidgetTitle } from '@/shared/ui/widget-title'; +import { generalMaterials } from 'data'; import styles from './general.module.scss'; const cx = classNames.bind(styles); -const materials = [ - [ - { - id: 0, - text: '', - title: 'School documentation', - link: 'https://docs.rs.school', - }, - ], - 'All materials are publicly available on YouTube and GitHub', - 'We also suggest that you familiarize yourself with the summary of the first stage of training.', -]; - export const General = () => { return (
@@ -30,7 +18,7 @@ export const General = () => {
Materials - +
Certificate From f13c886677f777132a60f68d7da12f10ab624b57 Mon Sep 17 00:00:00 2001 From: Bohdan Shcherbyna Date: Mon, 16 Dec 2024 14:11:25 +0200 Subject: [PATCH 5/6] refactor: 694 - change to use constant for link --- dev-data/general.data.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev-data/general.data.ts b/dev-data/general.data.ts index 3d9f7f98b..da87c0ce2 100644 --- a/dev-data/general.data.ts +++ b/dev-data/general.data.ts @@ -1,10 +1,12 @@ +import { RS_DOCS_EN_LINK } from './communication.data'; + export const generalMaterials = [ [ { id: 0, text: '', title: 'School documentation', - link: 'https://docs.rs.school', + link: RS_DOCS_EN_LINK, }, ], 'All materials are publicly available on YouTube and GitHub', From 7503536c6ae438b2ae6d17a01437697c862be383 Mon Sep 17 00:00:00 2001 From: Bohdan Shcherbyna Date: Mon, 16 Dec 2024 14:12:07 +0200 Subject: [PATCH 6/6] refactor: 694 - modify tests --- src/widgets/general/ui/general.test.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/widgets/general/ui/general.test.tsx b/src/widgets/general/ui/general.test.tsx index e46510a4d..8565f2a91 100644 --- a/src/widgets/general/ui/general.test.tsx +++ b/src/widgets/general/ui/general.test.tsx @@ -2,6 +2,7 @@ import { screen } from '@testing-library/react'; import { beforeEach, describe, expect, it } from 'vitest'; import { General } from './general'; import { renderWithRouter } from '@/shared/__tests__/utils'; +import { RS_DOCS_EN_LINK } from 'data'; describe('General', () => { beforeEach(() => { @@ -9,12 +10,15 @@ describe('General', () => { }); it('displays the General title', () => { - expect(screen.getByText('General')).toBeVisible(); + expect(screen.getByTestId('widget-title')).toBeVisible(); }); it('displays the Materials section', () => { + const documentationLink = screen.getByText('School documentation'); + expect(screen.getByText('Materials')).toBeVisible(); - expect(screen.getByText('School documentation')).toBeVisible(); + expect(documentationLink).toBeVisible(); + expect(documentationLink).toHaveAttribute('href', RS_DOCS_EN_LINK); }); it('displays the Certificate section', () => {