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

694-refactor: Widget general #695

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 14 additions & 0 deletions dev-data/general.data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { RS_DOCS_EN_LINK } from './communication.data';

export const generalMaterials = [
[
{
id: 0,
text: '',
title: 'School documentation',
link: RS_DOCS_EN_LINK,
},
],
'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.',
];
1 change: 1 addition & 0 deletions dev-data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
67 changes: 0 additions & 67 deletions src/widgets/general/general.scss

This file was deleted.

46 changes: 0 additions & 46 deletions src/widgets/general/general.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/widgets/general/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { General } from './general';
export { General } from './ui/general';
29 changes: 29 additions & 0 deletions src/widgets/general/ui/general.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.general {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(2, max-content);
column-gap: 24px;

.title {
grid-column: 1 / -1;
}

.info-block {
display: flex;
flex-direction: column;
gap: 16px;

max-width: 380px;

color: $color-gray-600;
}

@include media-tablet {
grid-template-columns: 1fr;
column-gap: 0;

.info-block {
margin-top: 24px;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@ 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(() => {
renderWithRouter(<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', () => {
Expand Down
39 changes: 39 additions & 0 deletions src/widgets/general/ui/general.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
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 { generalMaterials } from 'data';

import styles from './general.module.scss';

const cx = classNames.bind(styles);

export const General = () => {
return (
<section className={cx('container')}>
<div className={cx('general', 'content')}>
<WidgetTitle className={cx('title')} size="small">
General
</WidgetTitle>
<article className={cx('info-block')}>
<Subtitle>Materials</Subtitle>
<List data={generalMaterials} />
</article>
<article className={cx('info-block')}>
<Subtitle>Certificate</Subtitle>
<Paragraph>
A certificate of successful completion of the course is issued to all who have passed
the two stages of training.
</Paragraph>
</article>
<article className={cx('info-block')}>
<Subtitle>Chat</Subtitle>
<Paragraph>
Open chat for applicants and students on Discord, Telegram and more.
</Paragraph>
</article>
</div>
</section>
);
};
Loading