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

499-refactor: Widget alumni #501

Merged
merged 13 commits into from
Sep 27, 2024
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 13 additions & 13 deletions src/shared/__tests__/visualTesting/report/index.html

Large diffs are not rendered by default.

63 changes: 0 additions & 63 deletions src/widgets/alumni/alumni.test.tsx

This file was deleted.

5 changes: 2 additions & 3 deletions src/widgets/alumni/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { AlumniProps } from './ui/alumni';
import aesoft from '@/shared/assets/alumni/aesoft.svg';
import andersen from '@/shared/assets/alumni/andersen.svg';
import coherent from '@/shared/assets/alumni/coherent.svg';
Expand All @@ -18,7 +17,7 @@ import sberbank from '@/shared/assets/alumni/sberbank.svg';
import toptal from '@/shared/assets/alumni/toptal.svg';
import visualfabriq from '@/shared/assets/alumni/visualfabriq.svg';

export const alumni: AlumniProps[] = [
export const alumni = [
{
id: 'epam',
image: epam,
Expand Down Expand Up @@ -91,4 +90,4 @@ export const alumni: AlumniProps[] = [
id: 'aesoft',
image: aesoft,
},
];
] as const;
54 changes: 54 additions & 0 deletions src/widgets/alumni/ui/alumni.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
.info-wrapper {
h2,
ansivgit marked this conversation as resolved.
Show resolved Hide resolved
p {
width: 640px;

@include media-tablet {
width: 100%;
}
}

p {
margin-top: 16px;
ansivgit marked this conversation as resolved.
Show resolved Hide resolved
}
}

.alumni {
display: grid;
grid-template-columns: repeat(12, 1fr);
row-gap: 48px;
place-items: center;

margin-top: 40px;
ansivgit marked this conversation as resolved.
Show resolved Hide resolved
margin-bottom: 48px;
}

.logo-container {
display: block;
grid-column: span 2;

@include media-laptop {
grid-column: span 3;

&:nth-child(n + 13) {
display: none;
}
}

@include media-tablet {
grid-column: span 6;

&:nth-child(n + 7) {
display: none;
}
}

@include media-mobile {
grid-column: span 12;
}
}
Quiddlee marked this conversation as resolved.
Show resolved Hide resolved

.logo {
width: 141px;
height: 40px;
}
47 changes: 0 additions & 47 deletions src/widgets/alumni/ui/alumni.scss

This file was deleted.

19 changes: 19 additions & 0 deletions src/widgets/alumni/ui/alumni.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { Alumni } from './alumni';

describe('Alumni', () => {
ansivgit marked this conversation as resolved.
Show resolved Hide resolved
it('renders the title correctly', () => {
render(<Alumni />);
const titleElement = screen.getByText('Our alumni');

expect(titleElement).toBeInTheDocument();
});

it('renders the paragraph correctly', () => {
render(<Alumni />);
const paragraphElement = screen.getByText(/We are immensely proud of RS School alumni/i);

expect(paragraphElement).toBeInTheDocument();
});
});
33 changes: 9 additions & 24 deletions src/widgets/alumni/ui/alumni.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,26 @@
import classNames from 'classnames/bind';
import { alumni } from '../constants';
import { useWindowSize } from '@/shared/hooks/use-window-size';
import { Image } from '@/shared/ui/image';
import { Paragraph } from '@/shared/ui/paragraph';
import { WidgetTitle } from '@/shared/ui/widget-title';

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

export interface AlumniProps {
id: string;
image: string;
}
const cx = classNames.bind(styles);

export const Alumni = () => {
const size = useWindowSize();

let alumniArr = [];

if (size.width <= 1440 && size.width > 810) {
alumniArr = alumni.slice(0, 12);
} else if (size.width <= 810) {
alumniArr = alumni.slice(0, 6);
} else {
alumniArr = [...alumni];
}

return (
<article className="alumni container">
<section className="alumni content">
<article className={cx('container')}>
<section className={cx('content', 'info-wrapper')}>
Quiddlee marked this conversation as resolved.
Show resolved Hide resolved
<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="alumni">
{alumniArr.map(({ id, image }) => (
<figure key={id} className="alumni-logo-container">
<Image className="alumni-logo" src={image} alt={id} />
<section className={cx('alumni')}>
ansivgit marked this conversation as resolved.
Show resolved Hide resolved
{alumni.map(({ id, image }) => (
<figure key={id} className={cx('logo-container')}>
<Image className={cx('logo')} src={image} alt={id} />
</figure>
))}
</section>
Expand Down
Loading