Skip to content

887-refactor: Partners refactor #892

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

Draft
wants to merge 14 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
2 changes: 1 addition & 1 deletion src/shared/icons/aws.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import Image from 'next/image';
import aws from '@/shared/assets/icons/aws-gray.svg';

export const AwsLogo = () => {
return <Image src={aws} alt="AWS icon" />;
return <Image src={aws} alt="AWS icon" data-testid="AWS icon" />;
};
2 changes: 1 addition & 1 deletion src/shared/icons/github.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import Image from 'next/image';
import github from '@/shared/assets/svg/github.svg';

export const GithubLogo = () => {
return <Image src={github} alt=" github icon" />;
return <Image src={github} alt="github icon" data-testid="github icon" />;
};
2 changes: 1 addition & 1 deletion src/shared/icons/jetbrains.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import Image from 'next/image';
import jetbrains from '@/shared/assets/svg/jetbrains.svg';

export const JetBrainsLogo = () => {
return <Image src={jetbrains} alt="jetbrains icon" />;
return <Image src={jetbrains} alt="jetbrains icon" data-testid="jetbrains icon" />;
};
16 changes: 8 additions & 8 deletions src/widgets/alumni/ui/alumni.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ const cx = classNames.bind(styles);

export const Alumni = () => {
return (
<article className={cx('container')}>
<section className={cx('content', 'alumni')}>
<section className={cx('container')}>
<div className={cx('content', 'alumni')}>
<WidgetTitle mods="asterisk">Our alumni</WidgetTitle>
<Paragraph>
We are immensely proud of RS School alumni who build their successful careers in ambitious
IT companies
</Paragraph>
<section className={cx('alumni-list')}>
<ul className={cx('alumni-list')}>
{alumni.map(({ id, image }) => (
<figure key={id} className={cx('logo-container')}>
<li key={id} className={cx('logo-container')}>
<Image className={cx('logo')} src={image} alt={id} />
</figure>
</li>
))}
</section>
</section>
</article>
</ul>
</div>
</section>
);
};
16 changes: 16 additions & 0 deletions src/widgets/partnered/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { AwsLogo, GithubLogo, JetBrainsLogo } from '@/shared/icons';

export const partners = [
{
id: 'jetbrains',
Component: JetBrainsLogo,
},
{
id: 'aws',
Component: AwsLogo,
},
{
id: 'github',
Component: GithubLogo,
},
];
2 changes: 1 addition & 1 deletion src/widgets/partnered/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { Partnered } from './partnered';
export { Partnered } from './ui/partnered';
42 changes: 0 additions & 42 deletions src/widgets/partnered/partnered.scss

This file was deleted.

13 changes: 0 additions & 13 deletions src/widgets/partnered/partnered.test.tsx

This file was deleted.

23 changes: 0 additions & 23 deletions src/widgets/partnered/partnered.tsx

This file was deleted.

35 changes: 35 additions & 0 deletions src/widgets/partnered/ui/partnered.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.partnered-content {
display: flex;
flex-direction: column;
gap: 16px;

.partners {
display: flex;
flex-flow: row wrap;
align-items: center;
align-self: center;
justify-content: space-between;

width: 100%;
max-width: 500px;

.partner-logo-container {
display: flex;
flex-basis: 20%;
align-items: center;
justify-content: center;

@include media-mobile {
flex-basis: 50%;
}
}

@include media-tablet {
row-gap: 16px;
}

@include media-mobile {
row-gap: 48px;
}
}
}
52 changes: 52 additions & 0 deletions src/widgets/partnered/ui/partnered.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';

import { Partnered } from './partnered';
import { partners } from '../constants';
import aws from '@/shared/assets/icons/aws-gray.svg';
import github from '@/shared/assets/svg/github.svg';
import jetbrains from '@/shared/assets/svg/jetbrains.svg';

const partnersLogoData = [
{
testId: 'jetbrains icon',
alt: 'jetbrains icon',
src: jetbrains.src,
},
{
testId: 'AWS icon',
alt: 'AWS icon',
src: aws.src,
},
{
testId: 'github icon',
alt: 'github icon',
src: github.src,
},
];

describe('Partnered component', () => {
beforeEach(() => {
render(<Partnered />);
});
it('renders correct content for component', async () => {
const title = await screen.findByTestId('widget-title');
const partnersList = await screen.findByTestId('partners-list');

expect(title).toBeVisible();
expect(title.textContent).toBe('Partnered with');

expect(partnersList).toBeVisible();
expect(partnersList.children).toHaveLength(partners.length);
});

it.each(partnersLogoData)(
'renders $testId logo with correct attributes',
({ testId, alt, src }) => {
const logo = screen.getByTestId(testId);

expect(logo).toHaveAttribute('alt', alt);
expect(logo).toHaveAttribute('src', src);
},
);
});
23 changes: 23 additions & 0 deletions src/widgets/partnered/ui/partnered.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import classNames from 'classnames/bind';

import { partners } from '../constants';
import { WidgetTitle } from '@/shared/ui/widget-title';

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

const cx = classNames.bind(styles);

export const Partnered = () => (
<section className={cx('container')} data-testid="partnered">
<div className={cx('partnered-content', 'content')}>
<WidgetTitle size="small">Partnered with</WidgetTitle>
<ul className={cx('partners')} data-testid="partners-list">
{partners.map(({ id, Component }) => (
<li key={id} className={cx('partner-logo-container')}>
<Component />
</li>
))}
</ul>
</div>
</section>
);
Loading