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

DRAFT 742-feat: Update subtitle to support heading tags #806

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

oibioib
Copy link
Collaborator

@oibioib oibioib commented Mar 2, 2025

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

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

Description

Update Subtitle component to support heading tags from h2 to h6 (h3 by default). Add tests for new headings level.

Related Tickets & Documents

Screenshots, Recordings

Please replace this line with any relevant images for UI changes.

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

    • Enhanced the subtitle component to support dynamic heading levels, allowing it to render as different heading styles (h2, h3, h4, h5, h6) based on a configurable option.
    • Introduced new font weight variants (light and regular) for subtitle styling.
  • Bug Fixes

    • Improved visual emphasis of the mentor's name and course subtitle by standardizing the use of the subtitle component.
  • Tests

    • Added comprehensive test cases to ensure the subtitle renders correctly at various heading levels.

Copy link
Contributor

coderabbitai bot commented Mar 2, 2025

πŸ“ Walkthrough

Walkthrough

The changes update the Subtitle component and its tests to support dynamic heading levels. The component now accepts an optional as property to render different HTML heading tags (from h2 to h6), defaulting to h3. Corresponding test cases have been added and updated to validate that the component renders the correct heading element based on the provided prop. Additionally, new CSS class modifiers for font-weight styling have been introduced.

Changes

Files Change Summary
src/shared/ui/subtitle/subtitle.tsx Added an optional as property (accepting 'h2'-'h6') to SubtitleProps; updated the component to dynamically render the heading element using a variable HeadingTag, with a default of h3.
src/shared/ui/subtitle/subtitle.test.tsx Modified existing test to clarify default h3 rendering; added new test cases to verify the component correctly renders as h2, h4, h5, and h6 when provided as the as prop.
src/shared/ui/subtitle/subtitle.module.scss Introduced new CSS class modifiers .light and .regular for font-weight styling options in the .subtitle class.
src/entities/mentor/ui/mentor-feedback-card/mentor-feedback-card.module.scss Removed .card-title class and font-weight from .card-subtitle, altering visual emphasis.
src/entities/mentor/ui/mentor-feedback-card/mentor-feedback-card.tsx Replaced h4 element with Subtitle component for mentor's name and course subtitle, standardizing styling.
src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.module.scss Removed &-subtitle class definition, affecting visual presentation.
src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.tsx Modified Subtitle props and reformatted paragraph element for improved readability.

Sequence Diagram(s)

sequenceDiagram
    participant U as User/Application
    participant S as Subtitle Component
    participant T as Test Suite

    U->>S: Render Subtitle (optionally with "as" prop)
    S->>S: Determine HTML tag based on provided "as" (default: h3)
    S-->>U: Output the appropriate heading element
    T->>S: Execute test to verify rendered tag matches expectation
Loading

Possibly related PRs

Suggested labels

refactor, good first issue, preview

Suggested reviewers

  • Quiddlee
  • ansivgit
  • dzmitry-varabei
  • andron13
  • SpaNb4

πŸ“œ 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 5a888b6 and 6551139.

πŸ“’ Files selected for processing (4)
  • src/entities/mentor/ui/mentor-feedback-card/mentor-feedback-card.module.scss (0 hunks)
  • src/entities/mentor/ui/mentor-feedback-card/mentor-feedback-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)
πŸ’€ Files with no reviewable changes (2)
  • src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.module.scss
  • src/entities/mentor/ui/mentor-feedback-card/mentor-feedback-card.module.scss
πŸ”‡ Additional comments (4)
src/entities/mentor/ui/mentor-feedback-card/mentor-feedback-card.tsx (2)

42-44: Appropriate weight specification for the mentor name.

The added weight property makes the mentor name visually more prominent, which improves hierarchy and readability.


45-53: Good implementation of heading hierarchy.

Converting from an h4 element to using the Subtitle component with as="h4" maintains semantic structure while leveraging the Subtitle component's functionality. The explicit weight specification ensures consistent styling.

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

36-38: Appropriate weight specification for step subtitle.

Adding the weight property ensures visual prominence of the step number and subtitle.


40-42: Minor code formatting improvement.

The spacing changes in the paragraph element improve code readability without changing functionality.

✨ Finishing Touches
  • πŸ“ Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❀️ Share
πŸͺ§ 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.

@oibioib oibioib changed the title 742-feat: Update subtitle to support heading tags DRAFT 742-feat: Update subtitle to support heading tags Mar 2, 2025
@oibioib
Copy link
Collaborator Author

oibioib commented Mar 2, 2025

Do we need to change all h2-h6 tags in code to Subtitle component?

@oibioib oibioib changed the title DRAFT 742-feat: Update subtitle to support heading tags 742-feat: Update subtitle to support heading tags Mar 2, 2025
@SpaNb4
Copy link
Collaborator

SpaNb4 commented Mar 3, 2025

Do we need to change all h2-h6 tags in code to Subtitle component?

Yes

@oibioib oibioib changed the title 742-feat: Update subtitle to support heading tags DRAFT 742-feat: Update subtitle to support heading tags Mar 3, 2025
@karlovich karlovich marked this pull request as draft March 4, 2025 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Subtitle to Support h2-h6 Tags
2 participants