Skip to content

742-refactor: Update subtitle to support heading tags #844

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

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

oibioib
Copy link
Collaborator

@oibioib oibioib commented Apr 9, 2025

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

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

Description

The component accept props:

  • as
  • fontSize
  • fontWeight

Default heading level - h3.

Refactor code and change h3-h4 tags to Subtitle.

Related Tickets & Documents

Added/updated tests?

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

[optional] Are there any post deployment tasks we need to perform?

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

Summary by CodeRabbit

  • New Features

    • Introduced a flexible Subtitle component that can render as different heading levels (h2–h6) with customizable font size and weight.
  • Style

    • Standardized heading and subtitle styles across components by replacing native HTML headings with the Subtitle component.
    • Simplified and streamlined SCSS styles for headings, subtitles, and titles in various components.
    • Updated naming conventions and structure for subtitle-related CSS classes for consistency.
    • Adjusted spacing in documentation layouts for improved readability.
  • Refactor

    • Updated all usages of the Subtitle component to use the new fontWeight prop and improved class naming.
    • Removed redundant or unused CSS classes and properties.
  • Tests

    • Enhanced Subtitle component tests to cover new rendering options and updated class names.

@oibioib
Copy link
Collaborator Author

oibioib commented Apr 9, 2025

run visual now

Copy link
Contributor

coderabbitai bot commented Apr 9, 2025

πŸ“ Walkthrough

Walkthrough

This change refactors the Subtitle component to accept an as prop, allowing it to render as any heading element from h2 to h6, defaulting to h3. The codebase is updated to use the new prop and naming conventions (fontWeight instead of weight). Corresponding CSS modules are reorganized to match the updated class naming. All usages of Subtitle are revised, and related heading elements are replaced with the Subtitle component. Unit tests are updated and expanded to cover the new functionality.

Changes

Files/Groups Change Summary
src/shared/ui/subtitle/subtitle.tsx, subtitle.module.scss, subtitle.test.tsx Refactored Subtitle to accept as prop for heading levels, renamed weight to fontWeight, updated styles and tests.
src/app/docs/components/search/search.tsx, event-card.tsx, mentor-feedback-card.tsx, trainers-card.tsx, playlist.tsx, modal.tsx, school-menu.tsx, mentorship-hero.tsx, activity-card.tsx, mentors-after-register.tsx Replaced standard heading elements with Subtitle and/or updated to use new fontWeight and as props.
event-card.module.scss, mentor-feedback-card.module.scss, trainer-card.module.scss, modal.module.scss, playlist.module.scss, mentors-after-register.module.scss, school-menu.module.scss Removed or updated font-size and font-weight styles to align with Subtitle styling.
docs-layout.module.scss Increased vertical gap in .docs-content from 40px to 50px.

Sequence Diagram(s)

sequenceDiagram
  participant ParentComponent
  participant Subtitle

  ParentComponent->>Subtitle: Render with as="h2" | "h3" | ... | fontWeight="bold"
  Subtitle->>Subtitle: Determine HeadingTag from as prop (default h3)
  Subtitle->>Subtitle: Apply font size/weight classes
  Subtitle-->>ParentComponent: Rendered heading element with correct tag and styles
Loading

Assessment against linked issues

Objective Addressed Explanation
Subtitle accepts as/headingLevel prop for h2-h6 (default h3) (#742) βœ…
Refactor usages to use new prop and maintain styling (#742) βœ…
Unit tests for heading levels (#742) βœ…
No styling breaks for Subtitle usage (#742) βœ…

Possibly related PRs

Suggested labels

refactor

Suggested reviewers

  • andron13
  • dzmitry-varabei
  • natanchik
  • SpaNb4
  • ansivgit

Tip

βš‘πŸ’¬ Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

πŸ“œ Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between cad043b and 0adb410.

πŸ“’ Files selected for processing (9)
  • src/app/docs/components/docs-layout/docs-layout.module.scss (1 hunks)
  • src/entities/event/ui/event-card/event-card.tsx (2 hunks)
  • src/entities/mentor/ui/mentor-feedback-card/mentor-feedback-card.module.scss (1 hunks)
  • src/entities/mentor/ui/mentor-feedback-card/mentor-feedback-card.tsx (1 hunks)
  • src/entities/trainer/ui/trainers-card/trainer-card.module.scss (1 hunks)
  • src/entities/trainer/ui/trainers-card/trainer-card.tsx (2 hunks)
  • src/shared/ui/subtitle/subtitle.module.scss (1 hunks)
  • src/shared/ui/subtitle/subtitle.test.tsx (3 hunks)
  • src/shared/ui/subtitle/subtitle.tsx (1 hunks)
βœ… Files skipped from review due to trivial changes (2)
  • src/app/docs/components/docs-layout/docs-layout.module.scss
  • src/entities/mentor/ui/mentor-feedback-card/mentor-feedback-card.tsx
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/entities/event/ui/event-card/event-card.tsx
  • src/entities/trainer/ui/trainers-card/trainer-card.tsx
  • src/shared/ui/subtitle/subtitle.tsx
  • src/shared/ui/subtitle/subtitle.test.tsx
  • src/entities/mentor/ui/mentor-feedback-card/mentor-feedback-card.module.scss
  • src/shared/ui/subtitle/subtitle.module.scss
  • src/entities/trainer/ui/trainers-card/trainer-card.module.scss

πŸͺ§ Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/shared/ui/subtitle/subtitle.tsx (1)

9-9: Consider including h1 for completeness

The component supports heading levels h2-h6, but h1 is excluded. Consider whether h1 should be included for completeness, although it's typically reserved for page titles.

πŸ“œ Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 5c72b1b and 9757a5f.

πŸ“’ Files selected for processing (21)
  • src/app/docs/components/search/search.module.scss (1 hunks)
  • src/app/docs/components/search/search.tsx (2 hunks)
  • src/entities/event/ui/event-card/event-card.module.scss (0 hunks)
  • src/entities/event/ui/event-card/event-card.tsx (2 hunks)
  • src/entities/mentor/ui/mentor-feedback-card/mentor-feedback-card.module.scss (1 hunks)
  • src/entities/mentor/ui/mentor-feedback-card/mentor-feedback-card.tsx (1 hunks)
  • src/entities/trainer/ui/trainers-card/trainer-card.module.scss (0 hunks)
  • src/entities/trainer/ui/trainers-card/trainer-card.tsx (2 hunks)
  • src/shared/ui/modal/modal.module.scss (0 hunks)
  • src/shared/ui/modal/modal.tsx (2 hunks)
  • src/shared/ui/subtitle/subtitle.module.scss (1 hunks)
  • src/shared/ui/subtitle/subtitle.test.tsx (1 hunks)
  • src/shared/ui/subtitle/subtitle.tsx (2 hunks)
  • src/shared/ui/video-playlist-with-player/playlist/playlist.module.scss (0 hunks)
  • src/shared/ui/video-playlist-with-player/playlist/playlist.tsx (2 hunks)
  • src/views/mentorship/mentorship-hero/ui/mentorship-hero.tsx (1 hunks)
  • src/views/mentorship/ui/mentor-activities/ui/activity-card/activity-card.tsx (1 hunks)
  • src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.module.scss (0 hunks)
  • src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.tsx (1 hunks)
  • src/widgets/school-menu/ui/school-menu/school-menu.module.scss (0 hunks)
  • src/widgets/school-menu/ui/school-menu/school-menu.tsx (2 hunks)
πŸ’€ Files with no reviewable changes (6)
  • src/shared/ui/modal/modal.module.scss
  • src/shared/ui/video-playlist-with-player/playlist/playlist.module.scss
  • src/entities/event/ui/event-card/event-card.module.scss
  • src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.module.scss
  • src/entities/trainer/ui/trainers-card/trainer-card.module.scss
  • src/widgets/school-menu/ui/school-menu/school-menu.module.scss
πŸ”‡ Additional comments (31)
src/app/docs/components/search/search.module.scss (1)

22-23: Added appropriate spacing to search results

Adding margin-top improves the visual separation between the search input and results.

src/views/mentorship/mentorship-hero/ui/mentorship-hero.tsx (1)

30-30: Updated property name from weight to fontWeight

Property name change aligns with the subtitle component refactoring.

src/views/mentorship/ui/mentor-activities/ui/activity-card/activity-card.tsx (1)

21-21: Updated property name from weight to fontWeight

Consistent prop naming change for the Subtitle component.

src/entities/trainer/ui/trainers-card/trainer-card.tsx (2)

5-5: Added Subtitle component import

Appropriate import added for the new component usage.


19-24: Replaced HTML headings with Subtitle component

Effectively replaced h3/h4 elements with the Subtitle component, properly using the as prop to maintain semantic heading levels while achieving consistent styling.

src/app/docs/components/search/search.tsx (2)

10-10: Import of Subtitle component added correctly.

The Subtitle component is properly imported from the shared UI directory.


131-131: Appropriate usage of Subtitle component.

Replaced h3 element with Subtitle component using proper fontSize and fontWeight props. This aligns with the standardization goal of the PR.

src/widgets/school-menu/ui/school-menu/school-menu.tsx (2)

4-4: Import of Subtitle component added correctly.

The Subtitle component is properly imported from the shared UI directory.


21-21: Appropriate usage of Subtitle component.

Correctly replaced the heading element with Subtitle component while preserving the existing className handling.

src/shared/ui/subtitle/subtitle.test.tsx (2)

66-71: Test description clarified for default behavior.

Modified test description accurately indicates that h3 is the default rendering tag.


73-99: Comprehensive test coverage for new heading level functionality.

Added tests for all heading levels (h2, h4, h5, h6) with proper assertions. This ensures the new as prop is working correctly for all supported heading tags.

src/entities/event/ui/event-card/event-card.tsx (3)

5-5: Import of Subtitle component added correctly.

The Subtitle component is properly imported from the shared UI directory.


34-40: Appropriate usage of Subtitle component for organization section.

Correctly replaced heading elements with Subtitle components while setting appropriate props:

  • Used fontWeight="regular" for organizedBy text
  • Used as="h4" with fontSize="extra-small" for organization text

This maintains proper semantic structure while leveraging the new component.


42-46: Appropriate usage of Subtitle component for event title.

Correctly replaced the heading element with Subtitle component for the event title while preserving the className.

src/shared/ui/modal/modal.tsx (2)

6-6: Import of Subtitle component added appropriately

The Subtitle component is now correctly imported from the relative path.


105-107: Good refactoring to use the Subtitle component

The modal title now uses the standardized Subtitle component instead of direct HTML h2 element, maintaining the data-testid attribute for testing purposes.

src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.tsx (2)

36-38: Appropriate Subtitle configuration

The Subtitle component is properly configured with fontSize and fontWeight props, ensuring consistent heading styling.


39-41: Content formatting improved

The paragraph content is now formatted across multiple lines for better code readability without affecting the rendered output.

src/entities/mentor/ui/mentor-feedback-card/mentor-feedback-card.tsx (2)

42-50: Heading level explicitly defined with as="h4"

The Subtitle component now properly specifies the semantic heading level as h4 with appropriate fontWeight and fontSize props, maintaining the className and data-testid attribute.


51-59: Course info converted to Subtitle component

The course information is now consistently rendered using the Subtitle component with appropriate semantic level (h4) and styling (fontWeight="medium").

src/entities/mentor/ui/mentor-feedback-card/mentor-feedback-card.module.scss (1)

52-52: Line height added for better text readability

Adding line-height to .card-subtitle improves text readability and vertical spacing.

src/shared/ui/video-playlist-with-player/playlist/playlist.tsx (2)

4-4: Import statement added appropriately

The Subtitle component is imported correctly from the relative path.


24-26: Heading element replaced with Subtitle component

The h3 element has been successfully replaced with the Subtitle component, maintaining the same functionality while aligning with the new standardized approach. The fontSize prop is appropriately set to "small" and all original attributes are preserved.

src/shared/ui/subtitle/subtitle.module.scss (3)

55-57: Class renamed for clarity

The font weight class has been renamed from "normal" to "light-font-weight" to better reflect its purpose and improve naming consistency.


59-61: New font weight class added

A new "regular-font-weight" class has been added, expanding the available font weight options.


67-67: Class renamed for consistency

The "bold" class has been renamed to "bold-font-weight" to maintain naming consistency with other font weight classes.

src/shared/ui/subtitle/subtitle.tsx (5)

8-10: Added dynamic heading level support

The SubtitleProps now includes an optional "as" prop, allowing the component to render different heading levels (h2-h6).


23-28: Renamed weight variant for clarity

The "weight" variant has been renamed to "fontWeight" and values have been expanded to include "light", "regular", "medium", and "bold", improving naming clarity.


32-32: Updated default font weight

The default font weight is now explicitly set to "medium".


36-45: Component implementation improved

The Subtitle component now uses the "as" prop to dynamically determine the heading level, with h3 as the default. The HeadingTag variable is used appropriately to render the correct element.


47-48: Updated prop usage in component

The component now correctly uses "fontWeight" instead of "weight" and renders the appropriate heading element based on the "as" prop.

Also applies to: 50-50

@oibioib
Copy link
Collaborator Author

oibioib commented Apr 9, 2025

run visual now

Copy link

github-actions bot commented Apr 9, 2025

Lighthouse Report:

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

View detailed report

Copy link

github-actions bot commented Apr 9, 2025

Lighthouse Report:

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

View detailed report

Comment on lines 42 to 59
<Subtitle
as="h4"
fontWeight="bold"
fontSize="small"
className={cx('card-title')}
data-testid="card-title"
>
{name}
</Subtitle>
<h4 className={cx('card-subtitle')} data-testid="card-subtitle">
<Subtitle
as="h4"
fontWeight="medium"
className={cx('card-subtitle')}
data-testid="card-subtitle"
>
<b>Course: </b>
{course}
</h4>
</Subtitle>
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could use this:

          <Subtitle
            as="h3"
            fontWeight="bold"
            fontSize="small"
            className={cx('card-title')}
            data-testid="card-title"
          >
            {name}
          </Subtitle>
          <Subtitle
            as="h4"
            fontWeight="medium"
            fontSize="extra-small"
            className={cx('card-subtitle')}
            data-testid="card-subtitle"
          >
            <b>Course: </b>
            {course}
          </Subtitle>

And remove some properties from the .card-subtitle class

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

for fontSize="extra-small" we have 20px font-size
but here we need font-size: 18px

We don't have such susbtitle font-size.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Quiddlee @ansivgit, what are your thoughts on this? I'd prefer consistency across the site and avoid style overriding in cases like this. I don't think 18px or 20px makes much of a difference

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am of the same opinion.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree with @SpaNb4

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link

Lighthouse Report:

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

View detailed report

Copy link

Lighthouse Report:

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

View detailed report

@YulikK YulikK requested a review from SpaNb4 April 10, 2025 12:00
@ansivgit
Copy link
Collaborator

Please, add Playwright screenshots with differences

@@ -19,6 +19,8 @@
}

.results {
margin-top: 10px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, remove margin here and increase gap for .docs-content in docs/components/docs-layout/docs-layout.module.scss to 50px

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

@@ -127,7 +128,7 @@ function Result({ result }: { result: PagefindSearchResult }) {
return (
<div>
<Link href={removeHtmlExtension(data.url)}>
<h3>{data.meta.title}</h3>
<Subtitle fontSize="extra-small" fontWeight="bold">{data.meta.title}</Subtitle>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's change params to size & weight

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Change Subtitle props
fontSize -> size
fontWeight -> weight
?

@@ -30,12 +31,18 @@ export const EventCard = ({
<div className={cx('card-header')} data-testid="card-header">
<p className={cx('event-tag')}>{eventType}</p>
<section className={cx('about-organization')} data-testid="organization-section">
<h4 className={cx('organized-by')}>{organizedBy}</h4>
<h3 className={cx('event-organization')}>{organization}</h3>
<Subtitle fontWeight="regular" className={cx('organized-by')}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Before changes
Screenshot 2025-04-12 at 21 20 57

After changes
Screenshot 2025-04-12 at 21 25 15

Diffs
Screenshot 2025-04-12 at 21 25 06

Comment on lines 55 to 57
&.light-font-weight {
font-weight: $font-weight-light;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's change all class-names to match variable names, e.g.

Suggested change
&.light-font-weight {
font-weight: $font-weight-light;
}
&.font-weight {
&-light {
font-weight: $font-weight-light;
}
.....
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done. Also, I refactored font-size in the same way.

Comment on lines 73 to 99
it('renders as h2 element', () => {
render(<Subtitle as="h2">H2 Element</Subtitle>);
const subtitle = screen.getByTestId('subtitle');

expect(subtitle.tagName).toBe('H2');
});

it('renders as h4 element', () => {
render(<Subtitle as="h4">H4 Element</Subtitle>);
const subtitle = screen.getByTestId('subtitle');

expect(subtitle.tagName).toBe('H4');
});

it('renders as h5 element', () => {
render(<Subtitle as="h5">H5 Element</Subtitle>);
const subtitle = screen.getByTestId('subtitle');

expect(subtitle.tagName).toBe('H5');
});

it('renders as h6 element', () => {
render(<Subtitle as="h6">H6 Element</Subtitle>);
const subtitle = screen.getByTestId('subtitle');

expect(subtitle.tagName).toBe('H6');
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, use it.each instead

Suggested change
it('renders as h2 element', () => {
render(<Subtitle as="h2">H2 Element</Subtitle>);
const subtitle = screen.getByTestId('subtitle');
expect(subtitle.tagName).toBe('H2');
});
it('renders as h4 element', () => {
render(<Subtitle as="h4">H4 Element</Subtitle>);
const subtitle = screen.getByTestId('subtitle');
expect(subtitle.tagName).toBe('H4');
});
it('renders as h5 element', () => {
render(<Subtitle as="h5">H5 Element</Subtitle>);
const subtitle = screen.getByTestId('subtitle');
expect(subtitle.tagName).toBe('H5');
});
it('renders as h6 element', () => {
render(<Subtitle as="h6">H6 Element</Subtitle>);
const subtitle = screen.getByTestId('subtitle');
expect(subtitle.tagName).toBe('H6');
});
it.each(['h2', 'h3', 'h4'])('renders as %s element', (tag) => {
.....
});

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

}

.card-subtitle {
margin: 0;
font-size: 18px;
font-weight: $font-weight-medium;
line-height: 1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use line-height as in mentor-feedback-card component

Suggested change
line-height: 1;
line-height: 1.15;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

<Subtitle fontWeight="regular" className={cx('organized-by')}>
{organizedBy}
</Subtitle>
<Subtitle as="h4" fontSize="extra-small" className={cx('event-organization')}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use the same order of parameters: as - className- size - weight - data-testid. Please, fix this in all subtitles and other components you add.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

{`${id}. ${subtitle}`}
</Subtitle>

<p className={cx('step-content')} data-testid="step-content">{content}</p>
<p className={cx('step-content')} data-testid="step-content">
Copy link
Collaborator

Choose a reason for hiding this comment

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

As I can see we don't use class step-content and we could remove it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But this does not apply to the issue of subtitles.

@@ -7,7 +7,7 @@
.heading {
margin: 0;
font-size: 12px;
font-weight: $font-weight-medium;
line-height: 1.15;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need line-height here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Before changes here was default h3, with default browser line-height.

<h3 className={cx('heading', color)}>{heading}</h3>}

To keep the style of the element the same as before, I added line-height.

Comment on lines 37 to 42
as = 'h3',
children,
fontSize,
fontWeight,
className,
...props
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
as = 'h3',
children,
fontSize,
fontWeight,
className,
...props
as = 'h3',
className,
fontSize,
fontWeight,
children,
...props

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

Copy link
Collaborator

@ansivgit ansivgit left a comment

Choose a reason for hiding this comment

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

There's unexpected changes in course-card component (in all places where they're used)

Before
image

After
image

Please check all pages for other unexpected changes.

@oibioib
Copy link
Collaborator Author

oibioib commented Apr 16, 2025

On
https://pr844.rs.school/courses
https://rs.school/courses
and local dev, styles for course-card title is the same.

@oibioib
Copy link
Collaborator Author

oibioib commented Apr 16, 2025

run visual now

Copy link

Lighthouse Report:

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

View detailed report

@KristiBo KristiBo removed this from RS Site May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Subtitle to Support h2-h6 Tags
6 participants