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

Conversation

seygorin
Copy link
Collaborator

@seygorin seygorin commented Jul 11, 2024

What type of PR is this? (select all that apply)

  • πŸ• Feature
  • πŸ› Bug Fix
  • 🚧 Breaking Change
  • πŸ§‘β€πŸ’» Code Refactor
  • πŸ“ Documentation Update

Description

Subtitle component refactor
Apply CSS modules \ cva
Update tests

Related Tickets & Documents

Screenshots, Recordings

Nothing really changes.
Left - prod; Right - dev.
Screenshot 2024-09-12 at 13 06 53

Added/updated tests?

  • πŸ‘Œ Yes
  • πŸ™…β€β™‚οΈ No, because they aren't needed
  • πŸ™‹β€β™‚οΈ No, because I need help

[optional] What gif best describes this PR or how it makes you feel?

baby sloth

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced a new Subtitle component for improved semantic structure and flexible styling options.
    • Added support for additional styling props in the Subtitle component, enhancing layout control.
  • Bug Fixes

    • Updated the rendering logic for the Subtitle component to utilize a children-based approach, improving clarity.
  • Style

    • Enhanced styles for subtitles by implementing a modular SCSS approach, resulting in a cleaner and more maintainable design.
    • Streamlined the layout of components by refining CSS rules, improving visual flow.
    • Adjusted styles for subtitle elements across various components, enhancing visual presentation and consistency.
    • Removed outdated subtitle styles from specific components for a more cohesive design.
  • Tests

    • Updated test cases for the Subtitle component to reflect the new rendering method and props structure.

This comment was marked as outdated.

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

natanchik

This comment was marked as resolved.

natanchik

This comment was marked as resolved.

seygorin

This comment was marked as duplicate.

Copy link

Lighthouse Report:

  • Performance: 96 / 100
  • Accessibility: 98 / 100
  • Best Practices: 100 / 100
  • SEO: 100 / 100

View detailed report

src/shared/ui/subtitle/subtitle.test.tsx Outdated Show resolved Hide resolved
src/widgets/hero/ui/hero.tsx Outdated Show resolved Hide resolved
@SpaNb4
Copy link
Collaborator

SpaNb4 commented Sep 12, 2024

run visual now

Copy link

Lighthouse Report:

  • Performance: 76 / 100
  • Accessibility: 98 / 100
  • Best Practices: 100 / 100
  • SEO: 100 / 100

View detailed report

Copy link

Lighthouse Report:

  • Performance: 43 / 100
  • Accessibility: 98 / 100
  • Best Practices: 100 / 100
  • SEO: 100 / 100

View detailed report

@SpaNb4 SpaNb4 merged commit b6dcec5 into main Sep 12, 2024
4 checks passed
@SpaNb4 SpaNb4 deleted the refactor/375-subtitle-comp branch September 12, 2024 16:25
Comment on lines +22 to +24
<Paragraph fontSize="large">
Are you an RS sloth fan and looking for RS merch?
</Paragraph>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you please tell me why the line is broken in three lines?

Comment on lines -16 to -18
<WidgetTitle size="large" mods="lines">
Mentors wanted!
</WidgetTitle>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you please tell me why these lines are collapsed into one over your version?

Comment on lines +7 to +8
type SubtitleProps = Pick<HTMLAttributes<HTMLHeadingElement>, 'className' | 'children'> &
VariantProps<typeof subtitleVariants>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have seen the the same problem in our codebase before, but are we sure to use type SubtitleProps, which includes type of variable subtitleVariants, before definition of this variable?

Comment on lines +55 to +57
<Subtitle key="aws cloud dev 03">
Course highlights:
</Subtitle>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here too

Comment on lines +317 to +319
<Subtitle key="aws devops 04">
What do we offer?
</Subtitle>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here too

render(<Subtitle text="Test Subtitle" />);
const subtitle = screen.getByText('Test Subtitle');
render(<Subtitle>Test Subtitle</Subtitle>);
const subtitle = screen.getByTestId('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();

render(<Subtitle className="custom-class">Custom Class</Subtitle>);
const subtitle = screen.getByTestId('subtitle');

expect(subtitle).toHaveClass('custom-class');
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).toHaveClass('custom-class');
expect(subtitle).toHaveClass('custom-class', cx('gray-600'), cx('medium-font-size'));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FSD: Subtitle refactor
9 participants