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

375-refactor: Subtitle component refactor #401

Merged
merged 33 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a02c4de
refactor: subtitle component
seygorin Jul 10, 2024
9673dc1
fix: delete extra size at subtitle component
seygorin Jul 11, 2024
75279cf
refactor: test for subtitle component and change prop to children in …
seygorin Jul 11, 2024
a297a85
fix: update extected heading conut in for study-with-us section
seygorin Jul 11, 2024
76f7dc1
fix: delete src/shared/__tests__/visualTesting/report/index.html
seygorin Jul 11, 2024
7dd2600
fix: delete src/shared/__tests__/visualTesting/results/.last-run.json
seygorin Jul 11, 2024
ec16d59
fix: add black color to main-section
seygorin Jul 12, 2024
f2b3313
refactor: add subttitles to hero / communtication and trainer-card ui…
seygorin Jul 15, 2024
36a01f4
feat: added additional styles for title and subtitle
seygorin Jul 21, 2024
05d0910
refactor: replaced all duplicate styles (margin) with one from the co…
seygorin Jul 21, 2024
9c586ed
fix: edited test for speakers componets
seygorin Jul 21, 2024
658c589
fix: remove redundant render call
seygorin Jul 22, 2024
fb557a3
fix: change expected items in testes for speaker \ course components
seygorin Jul 22, 2024
fb179cf
fix: resolve merge conflicts
seygorin Jul 22, 2024
e0ac8c1
fix: reformat SCSS and fix color type issues
seygorin Jul 23, 2024
562fed2
docs: playWright test updated for the mac users according to main branch
seygorin Jul 23, 2024
3648c52
fix: make the hero components more generic
seygorin Jul 23, 2024
628d8f5
fix: remove redundant styles in trainers comp
seygorin Jul 23, 2024
fff3924
fix: 375 - resolve merge conflicts and remove extra code in widget-title
seygorin Aug 23, 2024
f9c616f
feat: 375 - added data-testid and rewrite tests
seygorin Aug 23, 2024
ca5c092
feat: 375 - updated playWright tests
seygorin Aug 24, 2024
58262dc
fix: 375 - resolved merge conflicts
seygorin Sep 6, 2024
784c9b9
refactor: 375 - changed margin to padding
seygorin Sep 6, 2024
a759632
feat: 375 - added tests cases
seygorin Sep 6, 2024
9b75b71
fix: 375 - removed redundant styles in widget-title
seygorin Sep 6, 2024
2c7e7fc
fix: 375 - merged with main
seygorin Sep 12, 2024
defad00
refactor: 375 - added extra fontSizes for component and upded tests
seygorin Sep 12, 2024
e2471d4
fix: 375 - merged with main
seygorin Sep 12, 2024
e5a0bcf
fix: 375 - prettier problems
seygorin Sep 12, 2024
ff10470
fix: 375 - orde of properties in a component
seygorin Sep 12, 2024
ab009dc
fix: 375 - changed fontSize names to kebab-case
seygorin Sep 12, 2024
0d111da
fix: 375 - merged with main
seygorin Sep 12, 2024
b115403
fix: 375 - deleted visualTesting folder
seygorin Sep 12, 2024
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
68 changes: 0 additions & 68 deletions src/shared/__tests__/visualTesting/report/index.html

This file was deleted.

4 changes: 0 additions & 4 deletions src/shared/__tests__/visualTesting/results/.last-run.json
seygorin marked this conversation as resolved.
Outdated
Show resolved Hide resolved

This file was deleted.

32 changes: 32 additions & 0 deletions src/shared/ui/subtitle/subtitle.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.subtitle {
ansivgit marked this conversation as resolved.
Show resolved Hide resolved
margin: 0;
natanchik marked this conversation as resolved.
Show resolved Hide resolved
font-weight: $font-weight-medium;
line-height: 28px;
letter-spacing: 0;
ansivgit marked this conversation as resolved.
Show resolved Hide resolved

&.medium {
font-size: 20px;

@include media-tablet {
font-size: 18px;
font-weight: $font-weight-regular;
}
ansivgit marked this conversation as resolved.
Show resolved Hide resolved
}

&.large {
font-size: 24px;

@include media-tablet {
font-size: 18px;
font-weight: $font-weight-regular;
}
ansivgit marked this conversation as resolved.
Show resolved Hide resolved
}

&.gray {
ansivgit marked this conversation as resolved.
Show resolved Hide resolved
color: $color-gray-600;
}

&.black {
color: $color-black;
}
ansivgit marked this conversation as resolved.
Show resolved Hide resolved
}
KristiBo marked this conversation as resolved.
Show resolved Hide resolved
18 changes: 0 additions & 18 deletions src/shared/ui/subtitle/subtitle.scss

This file was deleted.

4 changes: 2 additions & 2 deletions src/shared/ui/subtitle/subtitle.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { Subtitle } from './subtitle';

describe('Subtitle component', () => {
it('renders without crashing', () => {
render(<Subtitle text="Test Subtitle" />);
render(<Subtitle>Test Subtitle</Subtitle>);
const subtitle = screen.getByText('Test Subtitle');

expect(subtitle).toBeInTheDocument();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
expect(subtitle).toBeInTheDocument();
expect(subtitle).toBeVisible();

});

it('displays correct text', () => {
render(<Subtitle text="Another Test Subtitle" />);
render(<Subtitle>Another Test Subtitle</Subtitle>);
SpaNb4 marked this conversation as resolved.
Show resolved Hide resolved
const text = screen.getByText('Another Test Subtitle');

expect(text).toBeInTheDocument();
Expand Down
47 changes: 39 additions & 8 deletions src/shared/ui/subtitle/subtitle.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,41 @@
import './subtitle.scss';
import { HTMLAttributes } from 'react';
import { type VariantProps, cva } from 'class-variance-authority';
import classNames from 'classnames/bind';

interface SubtitleProps {
text: string;
type?: string;
}
import styles from './subtitle.module.scss';

export const Subtitle = ({ text, type = '' }: SubtitleProps) => (
<div className={`subtitle ${type}`}>{text}</div>
);
type SubtitleProps = HTMLAttributes<HTMLHeadingElement> & VariantProps<typeof subtitleVariants>;

export const cx = classNames.bind(styles);

const subtitleVariants = cva(cx('subtitle'), {
variants: {
size: {
medium: cx('medium'),
large: cx('large'),
},
color: {
gray: cx('gray'),
black: cx('black'),
},
},
defaultVariants: {
size: 'medium',
color: 'gray',
},
});

export const Subtitle = ({ children, size, color, ...props }: SubtitleProps) => {
return (
<h3
{...props}
className={subtitleVariants({
size,
color,
className: 'subtitle',
})}
>
{children}
</h3>
);
};
12 changes: 7 additions & 5 deletions src/widgets/about-home/ui/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ export const About = () => {
<div className="about container" id="about">
<div className="about content column-2">
<div className="left">
<WidgetTitle size="medium" mods="asterisk">Who we are</WidgetTitle>
<Subtitle
text="Our mission is to provide free education in intriguing subjects, connect people, and grow
together."
/>
<WidgetTitle size="medium" mods="asterisk">
Who we are
</WidgetTitle>
<Subtitle>
Our mission is to provide free education in intriguing subjects, connect people, and
grow together.
</Subtitle>
<Paragraph>
The Rolling Scopes was founded in 2013 in Minsk as a community of Front-end developers.
It has since grown into an enormous international developers community.
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/about-school/ui/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const About = () => {
<div className="column-2">
<div className="info">
<WidgetTitle size="medium" mods="asterisk">About RS School</WidgetTitle>
<Subtitle text="No matter your age, professional employment, or place of residence." />
<Subtitle>No matter your age, professional employment, or place of residence.</Subtitle>
<Paragraph>
RS School offers a unique learning experience as a free, community-based online
education initiative. The RS School has been run by the Rolling Scopes community since
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/communication/ui/communication.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const Communication = ({ courseName, lang = 'en' }: RequiredProps) => {
<DiscordLogo />
</figure>
<div>
<Subtitle text={localizedContent[lang].subTitle} />
<Subtitle>{localizedContent[lang].subTitle}</Subtitle>
seygorin marked this conversation as resolved.
Show resolved Hide resolved
<Paragraph>
{localizedContent[lang].firstParagraphFirstHalf}{' '}
<LinkCustom href={DISCORD_LINKS[courseName]} icon={<TextLinkIcon />} target="_blank">
Expand Down
18 changes: 15 additions & 3 deletions src/widgets/community/ui/community.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import image from '@/shared/assets/welcome.webp';
import { FacebookIcon, InstagramIcon, LinkedInIcon, TelegramIcon, YouTubeIcon } from '@/shared/icons';
import {
FacebookIcon,
InstagramIcon,
LinkedInIcon,
TelegramIcon,
YouTubeIcon,
} from '@/shared/icons';
import Image from '@/shared/ui/image';
import { SocialMedia, SocialMediaProps } from '@/shared/ui/social-media';
import { Subtitle } from '@/shared/ui/subtitle';
Expand Down Expand Up @@ -59,8 +65,14 @@ export const Community = () => (
<div id="community" className="community container">
<div className="community content column-2">
<div className="info">
<WidgetTitle size="large" mods="lines">Join RS Community</WidgetTitle>
<Subtitle text="If you want to learn coding or be a RS School mentor, speaking at developers meetups and conferences or taking part in RS clubs welcome to the Rolling Scopes community! Join us in social networks to be in touch!" />
<WidgetTitle size="large" mods="lines">
Join RS Community
</WidgetTitle>
<Subtitle>
If you want to learn coding or be a RS School mentor, speaking at developers meetups and
conferences or taking part in RS clubs welcome to the Rolling Scopes community! Join us in
social networks to be in touch!
</Subtitle>
<div className="social-media-container">
{communityGroups.map(({ title, href, icon }) => (
<SocialMedia key={title} title={title} href={href} icon={icon} />
Expand Down
9 changes: 7 additions & 2 deletions src/widgets/contribute/ui/contribute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ export const Contribute = () => (
<div className="contribute content">
<div className="general">
<div className="info">
<WidgetTitle size="medium" mods="asterisk">How to Contribute</WidgetTitle>
<Subtitle text="Contributing to The Rolling Scopes is not only a great way to give back to the community, but it's also an excellent way to enhance your own knowledge." />
<WidgetTitle size="medium" mods="asterisk">
How to Contribute
</WidgetTitle>
<Subtitle>
Contributing to The Rolling Scopes is not only a great way to give back to the
community, but it&apos;s also an excellent way to enhance your own knowledge.
</Subtitle>
<Paragraph>
Remember, teaching others is one of the best ways to learn - this is known as The
ProtΓ©gΓ© Effect! There are several ways you can contribute, choose yours.
Expand Down
6 changes: 5 additions & 1 deletion src/widgets/course-main/course-main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ export const CourseMain = ({ courseName, lang = 'en', type }: CourseMainProps) =
<div className={styles.info}>
<SectionLabel label={status} />
<WidgetTitle size="medium">{`${altTitle || title} Course`}</WidgetTitle>
{type && <Subtitle text={type} type="course-main" />}
{type && (
<Subtitle size="large" color="black">
{type}
</Subtitle>
)}
<DateLang startDate={startDate} language={language} mode={mode} type="main" />
<LinkCustom
href={enroll}
Expand Down
10 changes: 8 additions & 2 deletions src/widgets/events/ui/events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ export const Events = () => {
<div className={cn(cx('events', 'content'), 'content')}>
<section className={cx('info')}>
<SectionLabel label="events & meetups" />
<WidgetTitle size="medium" mods="asterisk">Meet us at events</WidgetTitle>
<Subtitle text="For years we have been organizing meetups and conferences, where you can always learn something new, share your knowledge, discover new technologies, meet old and find new friends." />
<WidgetTitle size="medium" mods="asterisk">
Meet us at events
</WidgetTitle>
<Subtitle>
For years we have been organizing meetups and conferences, where you can always learn
something new, share your knowledge, discover new technologies, meet old and find new
friends.
</Subtitle>
<Paragraph>
During
{' '}
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/main/ui/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const Main = () => {
<div className="left">
<div className="title-container">
<MainTitle>RS School</MainTitle>
<Subtitle text="Free courses. High motivation" />
<Subtitle color="black">Free courses. High motivation</Subtitle>
</div>
<h2 className="description">Connecting people, growing together, having fun</h2>
</div>
Expand Down
12 changes: 7 additions & 5 deletions src/widgets/mentors/ui/mentors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ export const Mentors = () => {
<section className="mentors container" id="mentors-wanted">
<div className="mentors content column-2">
<div className="mentors-info">
<WidgetTitle size="large" mods="lines">Mentors wanted!</WidgetTitle>
<Subtitle
text="The Rolling Scopes School is constantly looking for mentors from all over the world to
<WidgetTitle size="large" mods="lines">
Mentors wanted!
</WidgetTitle>
ansivgit marked this conversation as resolved.
Show resolved Hide resolved
<Subtitle>
seygorin marked this conversation as resolved.
Show resolved Hide resolved
The Rolling Scopes School is constantly looking for mentors from all over the world to
teach everyone who wants to learn the JavaScript language and the world of Front-end.
Over the past few years, over 1500+ people have successfully completed our six month
training program."
/>
training program.
</Subtitle>
<LinkCustom
href={LINKS.BECOME_MENTOR}
icon={<ArrowIcon />}
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/merch/ui/merch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Merch = () => (
<div className={cx('info')}>
<SectionLabel label="merch" />
<WidgetTitle size="medium" mods="asterisk">RS merch</WidgetTitle>
<Subtitle text="Are you an RS sloth fan and looking for RS merch?" />
<Subtitle>Are you an RS sloth fan and looking for RS merch?</Subtitle>
<Paragraph>
The wait is almost over as we&apos;re gearing up for the catalog of free web and print
assets where you will find all merch collections and can print your own Rolling Scopes
Expand Down
12 changes: 7 additions & 5 deletions src/widgets/numbers/ui/numbers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ export const Numbers = () => {
<div className="numbers content">
<div className="text-container">
<div>
<WidgetTitle size="medium" mods="asterisk">The Rolling Scopes in numbers</WidgetTitle>
<Subtitle
text="Everyone can discover our community, regardless of age, professional employment, or
place of residence."
/>
<WidgetTitle size="medium" mods="asterisk">
The Rolling Scopes in numbers
</WidgetTitle>
<Subtitle>
Everyone can discover our community, regardless of age, professional employment, or
place of residence.
</Subtitle>
<Paragraph>
Developers from different companies and countries are connected to pass on your
knowledge, enrich your network and just have fun.
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/required/ui/required.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const Required = ({ courseName, marked1, marked2 }: RequiredProps) => {
<div className="column-2">
{isKnowBeforeExist && (
<article>
<Subtitle text={knowBefore.title} />
<Subtitle>{knowBefore.title}</Subtitle>
<Actions actions={knowBefore.description} marked={marked1} />
</article>
)}
Expand All @@ -43,7 +43,7 @@ export const Required = ({ courseName, marked1, marked2 }: RequiredProps) => {
? willLearn.map((willLearn) => {
return (
<article key={willLearn.title}>
<Subtitle text={willLearn.title} />
<Subtitle>{willLearn.title}</Subtitle>
natanchik marked this conversation as resolved.
Show resolved Hide resolved
<Actions actions={willLearn.description} marked={marked2} />
</article>
);
Expand Down
11 changes: 8 additions & 3 deletions src/widgets/speakers/ui/speakers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ export const Speakers = () => (
<div className="speakers container">
<div className="speakers content">
<div className="info">
<WidgetTitle size="large" mods="lines">Speakers wanted</WidgetTitle>
<Subtitle text="If you want to give a talk or conduct a workshop, present your open source project or share a success story, the Rolling Scopes welcomes all kinds of talk proposals." />
<Subtitle text="So don't hesitate to drop a short synopsis to RS Head " />
<WidgetTitle size="large" mods="lines">
Speakers wanted
</WidgetTitle>
<Subtitle>
If you want to give a talk or conduct a workshop, present your open source project or
share a success story, the Rolling Scopes welcomes all kinds of talk proposals.
</Subtitle>
<Subtitle>So don&apos;t hesitate to drop a short synopsis to RS Head</Subtitle>

<div className="name" data-testid="contact-name">
Dzmitry Varabei
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/study-with-us/study-with-us.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('School Component', () => {
it('renders the study options correctly', () => {
const options = screen.getAllByRole('heading', { level: 3 });

expect(options.length).toBe(3);
expect(options.length).toBe(4);
SpaNb4 marked this conversation as resolved.
Show resolved Hide resolved
});

it('renders the correct description for each study option', () => {
Expand Down
9 changes: 7 additions & 2 deletions src/widgets/study-with-us/ui/study-with-us.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ export const StudyWithUs = () => (
<div className="study">
<div className="left">
<SectionLabel label="education" />
<WidgetTitle size="medium" mods="asterisk">Study with RS School</WidgetTitle>
<Subtitle text="RS School is a free and community-based online education program conducted by The Rolling Scopes Community since 2013. " />
<WidgetTitle size="medium" mods="asterisk">
Study with RS School
</WidgetTitle>
<Subtitle>
RS School is a free and community-based online education program conducted by The
Rolling Scopes Community since 2013.
</Subtitle>
<Paragraph>
Currently 500+ developers from different countries and companies involve in the
education process as mentors.
Expand Down
11 changes: 8 additions & 3 deletions src/widgets/support/ui/support.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ export const Support = () => (
<div className="support container">
<div className="support content">
<div className="info">
<WidgetTitle size="large" mods="lines">Support Us</WidgetTitle>
<Subtitle text="Your donations help us cover hosting, domains, licenses, and advertising for courses and events. Every donation, big or small, helps!" />
<Subtitle text="Thank you for your support!" />
<WidgetTitle size="large" mods="lines">
Support Us
</WidgetTitle>
ansivgit marked this conversation as resolved.
Show resolved Hide resolved
<Subtitle>
Your donations help us cover hosting, domains, licenses, and advertising for courses and
events. Every donation, big or small, helps!
</Subtitle>
<Subtitle>Thank you for your support!</Subtitle>
<LinkCustom
href={LINKS.DONATE}
icon={<ArrowIcon />}
Expand Down
10 changes: 5 additions & 5 deletions src/widgets/training-program/training-program.data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const contentMap: ContentMap = {
Be well-prepared to pass the &quot;AWS Certified Developer - Associate&quot; certification
and confidently apply your skills in real-world projects by the end of the course.
</Paragraph>,
<Subtitle key="aws cloud dev 03" text="Course highlights:" />,
<Subtitle key="aws cloud dev 03">Course highlights:</Subtitle>,
<Actions
key="aws cloud dev 04"
actions={[
Expand Down Expand Up @@ -255,10 +255,10 @@ export const contentMap: ContentMap = {
]}
marked
/>,
<Subtitle
key="react 03"
text="Attention! Mentors on this course will be first assigned to the graduates of the RS School Stage #2."
/>,
<Subtitle key="react 03">
Attention! Mentors on this course will be first assigned to the graduates of the RS School
Stage #2.
</Subtitle>,
],
image: reactEnImg,
},
Expand Down
Loading