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

774-feat: Mentorship post release updates: Course card design update #781

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

Conversation

Quiddlee
Copy link
Member

@Quiddlee Quiddlee commented Feb 9, 2025

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

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

Description

Related Tickets & Documents

Screenshots, Recordings

image

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

    • Course cards now offer size variants for more tailored presentation.
  • Style

    • Refined course card visuals with enhanced hover animations, responsive layouts, and improved image display.
    • Updated button designs with adjusted padding, borders, and icon alignment for a more cohesive look.
    • Enhanced overall visual depth through smoother transitions, enriched shadows, and optimized grid layouts for better responsiveness on varying screen sizes.

@Quiddlee Quiddlee added the feature New feature or request label Feb 9, 2025
@Quiddlee Quiddlee self-assigned this Feb 9, 2025
@Quiddlee Quiddlee requested a review from Copilot February 9, 2025 13:24

Choose a reason for hiding this comment

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

Copilot reviewed 8 out of 18 changed files in this pull request and generated no comments.

Files not reviewed (10)
  • src/core/styles/_constants.scss: Language not supported
  • src/core/styles/_mixins.scss: Language not supported
  • src/entities/course/ui/course-card/course-card.module.scss: Language not supported
  • src/shared/ui/date-lang/date-lang.module.scss: Language not supported
  • src/shared/ui/link-custom/link-custom.module.scss: Language not supported
  • src/views/mentorship/ui/mentorship-courses/mentorship-courses.module.scss: Language not supported
  • src/widgets/courses/ui/courses.module.scss: Language not supported
  • src/entities/course/ui/course-card/course-card.test.tsx: Evaluated as low risk
  • src/shared/icons/arrow-icon.tsx: Evaluated as low risk
  • src/shared/ui/date-lang/date-lang.test.tsx: Evaluated as low risk
@Quiddlee Quiddlee changed the title Feat/774 course card design update Feat-774: Mentorship post release updates: Course card design update Feb 9, 2025
@Quiddlee Quiddlee changed the title Feat-774: Mentorship post release updates: Course card design update 774-feat: Mentorship post release updates: Course card design update Feb 9, 2025
@SpaNb4
Copy link
Collaborator

SpaNb4 commented Feb 10, 2025

Hmm, the cards feel a bit too big now. I'm wondering if that'll hurt the UX a bit?
your changes:
image

current look:
image

@SpaNb4 SpaNb4 marked this pull request as ready for review February 24, 2025 16:27
Copy link
Contributor

coderabbitai bot commented Feb 24, 2025

πŸ“ Walkthrough

Walkthrough

This pull request applies numerous styling adjustments and minor refactoring across several SCSS and TSX files without changing component functionality. It reorders and removes redundant CSS declarations, adds new easing function variables and mixin updates, refines component props (e.g., removal of β€œmode” and addition of β€œsize”), and updates tests accordingly. Several UI components such as CourseCard, DateLang, LinkCustom, and ArrowIcon are updated to simplify their internal logic and rendering.

Changes

File(s) Summary
src/app/docs/.../docs-menu.module.scss, src/core/base-layout/.../burger.module.scss, src/core/base-layout/.../header.module.scss, src/core/styles/index.scss, src/shared/ui/modal/modal.module.scss, src/shared/ui/video-playlist-with-player/.../playlist.module.scss, src/views/mentorship/mentorship-hero/.../mentorship-hero.module.scss, src/views/mentorship/.../activity-card.module.scss, src/widgets/about-video/.../about-video.module.scss, src/widgets/courses/ui/courses.module.scss, src/views/mentorship/ui/mentorship-courses/mentorship-courses.module.scss Reordered and removed redundant CSS declarations (e.g. border, border-radius, line-height) without functional changes.
src/core/styles/_constants.scss, src/core/styles/_mixins.scss, src/shared/ui/date-lang/date-lang.module.scss, src/shared/ui/link-custom/link-custom.module.scss Added new easing function variables, updated mixin dimensions and transitions; adjusted spacing, borders, and nested styling in button and date-lang modules.
src/entities/course/ui/course-card/course-card.module.scss, src/entities/course/ui/course-card/course-card.tsx, src/entities/course/ui/course-card/course-card.test.tsx Introduced a new optional size prop, removed the obsolete mode prop, and adjusted padding, gap, pseudo-element, and hover effects while updating tests accordingly.
src/shared/ui/date-lang/date-lang.tsx, src/shared/ui/date-lang/date-lang.test.tsx Changed the DateLang component to accept children instead of a mode prop, and updated its tests to reflect the new logic for displaying date and language text.
src/shared/icons/arrow-icon.tsx, src/shared/ui/link-custom/link-custom.tsx Modified ArrowIcon to remove the size prop and updated LinkCustom to wrap icon rendering in an icon wrapper, with ArrowIcon now rendered without explicit dimensions.
src/widgets/courses/ui/courses.tsx, src/widgets/hero-course/ui/hero-course.tsx Updated Courses to pass the new size prop to CourseCard and removed the mode property from HeroCourse, simplifying component data handling.
src/views/mentorship/ui/mentor-activities/ui/activity-card/activity-card.test.tsx Updated tests to check text content using semantic methods instead of directly accessing innerHTML.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant CC as CourseCard
    participant DL as DateLang
    participant LC as LinkCustom
    participant AI as ArrowIcon

    U->>CC: Render CourseCard (with size prop)
    CC->>CC: Compute classes & dateText based on size
    CC->>DL: Render DateLang (with dateText and language)
    CC->>LC: Render LinkCustom (variant: secondary)
    LC->>AI: Render ArrowIcon (default sizing)
Loading

Possibly related PRs

Suggested labels

high priority, preview

Suggested reviewers

  • andron13
  • dzmitry-varabei
  • natanchik
  • Quiddlee
  • ansivgit
✨ Finishing Touches
  • πŸ“ Generate Docstrings (Beta)

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. (Beta)
  • @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: 2

πŸ”­ Outside diff range comments (1)
src/shared/icons/arrow-icon.tsx (1)

5-13: πŸ› οΈ Refactor suggestion

Consider specifying default dimensions.

Removing the size prop without specifying default dimensions could lead to inconsistent icon sizes across different contexts.

 export const ArrowIcon = () => {
   return (
     <Image
+      width={24}
+      height={24}
       src={arrow}
       alt="arrow icon"
       data-testid="arrow-icon"
     />
   );
 };
🧹 Nitpick comments (7)
src/widgets/courses/ui/courses.tsx (1)

28-28: Consider documenting size prop impact.

The addition of size="sm" addresses card size concerns raised in PR comments. Consider documenting the exact dimensions for each size variant ("sm", "md") to help track UI consistency.

src/shared/ui/link-custom/link-custom.tsx (1)

80-82: Simplify DOM structure.

The additional span wrapper is unnecessary unless specific styling requirements exist.

-      <span className={cx('icon-wrapper')}>
-        {!disabled && resolveIcon()}
-      </span>
+      {!disabled && resolveIcon()}
src/views/mentorship/ui/mentorship-courses/mentorship-courses.module.scss (1)

14-16: Review layout breakpoint change.

Changing to media-tablet-large means the layout will maintain 2 columns longer, which might address the card size concerns mentioned in PR feedback. However, verify that this doesn't cause layout issues on tablet-sized devices.

Consider implementing a more flexible grid system using minmax and auto-fit:

-    grid-template-columns: repeat(2, 1fr);
+    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
src/shared/ui/date-lang/date-lang.module.scss (2)

14-15: Consider maintaining previous gap size.

The increased gap (8px) contributes to larger overall component size. Consider keeping the previous 4px gap to maintain compact design.

-  gap: 8px;
+  gap: 4px;

28-31: Review icon size increase.

Larger icons (24px) may impact overall card size. Consider if 16px icons would suffice for visual hierarchy.

-  width: 24px;
-  height: 24px;
+  width: 16px;
+  height: 16px;
src/core/styles/_mixins.scss (1)

54-56: Consider the impact of increased card dimensions.

The card dimensions have been significantly increased (width: 310px, height: 300px). This aligns with user feedback expressing concerns about larger card sizes potentially impacting UX.

Consider A/B testing these dimensions to validate the impact on user experience across different viewport sizes.

src/entities/course/ui/course-card/course-card.tsx (1)

41-47: Consider extracting size-based logic.

The size-based text and font size logic could be moved to a separate utility function for better maintainability.

+const getCardConfig = (size: 'sm' | 'md') => ({
+  dateText: size === 'sm' ? 'Start:' : null,
+  fontSize: size === 'md' ? 'large' : 'small'
+});
+
 export const CourseCard = ({
   // ...props
 }) => {
-  const dateText = size === 'sm' ? 'Start:' : null;
-  const fontSize = size === 'md' ? 'large' : 'small';
+  const { dateText, fontSize } = getCardConfig(size);
πŸ“œ Review details

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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 0c2187a and 91a5281.

β›” Files ignored due to path filters (3)
  • src/shared/assets/icons/mic.svg is excluded by !**/*.svg
  • src/shared/assets/icons/note-icon.svg is excluded by !**/*.svg
  • src/shared/assets/svg/arrow.svg is excluded by !**/*.svg
πŸ“’ Files selected for processing (26)
  • src/app/docs/components/docs-menu/docs-menu.module.scss (1 hunks)
  • src/core/base-layout/components/header/burger/burger.module.scss (1 hunks)
  • src/core/base-layout/components/header/header.module.scss (1 hunks)
  • src/core/styles/_constants.scss (1 hunks)
  • src/core/styles/_mixins.scss (1 hunks)
  • src/core/styles/index.scss (1 hunks)
  • src/entities/course/ui/course-card/course-card.module.scss (2 hunks)
  • src/entities/course/ui/course-card/course-card.test.tsx (1 hunks)
  • src/entities/course/ui/course-card/course-card.tsx (1 hunks)
  • src/entities/mentor/ui/mentor-feedback-card/mentor-feedback-card.module.scss (2 hunks)
  • src/shared/icons/arrow-icon.tsx (1 hunks)
  • src/shared/ui/date-lang/date-lang.module.scss (1 hunks)
  • src/shared/ui/date-lang/date-lang.test.tsx (1 hunks)
  • src/shared/ui/date-lang/date-lang.tsx (2 hunks)
  • src/shared/ui/link-custom/link-custom.module.scss (3 hunks)
  • src/shared/ui/link-custom/link-custom.tsx (2 hunks)
  • src/shared/ui/modal/modal.module.scss (2 hunks)
  • src/shared/ui/video-playlist-with-player/playlist/playlist.module.scss (1 hunks)
  • src/views/mentorship/mentorship-hero/ui/mentorship-hero.module.scss (1 hunks)
  • src/views/mentorship/ui/mentor-activities/ui/activity-card/activity-card.module.scss (2 hunks)
  • src/views/mentorship/ui/mentor-activities/ui/activity-card/activity-card.test.tsx (1 hunks)
  • src/views/mentorship/ui/mentorship-courses/mentorship-courses.module.scss (1 hunks)
  • src/widgets/about-video/ui/about-video.module.scss (0 hunks)
  • src/widgets/courses/ui/courses.module.scss (1 hunks)
  • src/widgets/courses/ui/courses.tsx (1 hunks)
  • src/widgets/hero-course/ui/hero-course.tsx (0 hunks)
πŸ’€ Files with no reviewable changes (2)
  • src/widgets/about-video/ui/about-video.module.scss
  • src/widgets/hero-course/ui/hero-course.tsx
βœ… Files skipped from review due to trivial changes (10)
  • src/widgets/courses/ui/courses.module.scss
  • src/app/docs/components/docs-menu/docs-menu.module.scss
  • src/shared/ui/video-playlist-with-player/playlist/playlist.module.scss
  • src/core/base-layout/components/header/header.module.scss
  • src/core/base-layout/components/header/burger/burger.module.scss
  • src/core/styles/index.scss
  • src/entities/mentor/ui/mentor-feedback-card/mentor-feedback-card.module.scss
  • src/views/mentorship/mentorship-hero/ui/mentorship-hero.module.scss
  • src/shared/ui/modal/modal.module.scss
  • src/views/mentorship/ui/mentor-activities/ui/activity-card/activity-card.module.scss
πŸ”‡ Additional comments (11)
src/shared/ui/date-lang/date-lang.test.tsx (1)

25-25: Test update looks good.

The removal of the mode prop from test cases maintains test coverage while aligning with component changes.

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

51-51: Good test improvement.

Using toHaveTextContent instead of checking innerHTML is a more robust approach for testing text content.

src/core/styles/_constants.scss (1)

86-88: LGTM! Good choice of easing functions.

The added easing functions follow Material Design standards, providing smooth and natural animations.

src/entities/course/ui/course-card/course-card.test.tsx (1)

37-41: LGTM! Test updates reflect component changes.

The language display logic is now more explicit and the test coverage remains comprehensive.

src/shared/ui/date-lang/date-lang.tsx (1)

14-19: LGTM! Props refactoring improves component flexibility.

The removal of mode prop and addition of children prop enhances reusability.

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

95-126: LGTM! Size variants improve flexibility.

The size-sm variant provides a good solution for compact layouts.

src/shared/ui/link-custom/link-custom.module.scss (2)

19-20: LGTM! Button refinements improve consistency.

Reduced padding and consistent border styling enhance visual harmony.


72-79: LGTM! Icon wrapper improves alignment.

Consistent icon sizing and alignment through wrapper classes.

src/core/styles/_mixins.scss (1)

65-67:

❓ Verification inconclusive

Review hover animation performance.

The new hover animation using translate and scale could impact performance on lower-end devices when many cards are present.

Consider testing the hover animation performance with:


🏁 Script executed:

#!/bin/bash
# Check for will-change or transform properties that might help with performance
rg -g '*.scss' 'will-change|transform:'

Length of output: 1359


Investigate Hover Animation Performance

The hover animation in src/core/styles/_mixins.scss (lines 65–67) currently uses translate and scale without a will-change hint. This could lead to suboptimal performance on lower-end devices, especially with many cards on screen. Please verify animation smoothness across devices and consider adding will-change: transform (or a similar property) if needed to leverage hardware acceleration.

src/entities/course/ui/course-card/course-card.tsx (2)

24-26: LGTM! Good addition of size control.

The new size prop with 'sm' | 'md' options provides better control over card dimensions, addressing the size-related feedback.


55-55:

❓ Verification inconclusive

Verify accessibility with size changes.

The font size changes and conditional text might affect accessibility. Ensure proper contrast ratios and readability are maintained across both size variants.

Also applies to: 58-58, 66-66


🏁 Script executed:

#!/bin/bash
# Check for any existing accessibility-related styles
rg -g '*.scss' '(font-size|line-height|color).*:.*' src/entities/course/ui/course-card/

Length of output: 893


Accessibility Check: Verify Dynamic Styles and Contrast

Please ensure that the dynamic font size changes and conditional text at lines 55, 58, and 66 of src/entities/course/ui/course-card/course-card.tsx continue to meet accessibility standards. The SCSS file (course-card.module.scss) explicitly sets a 14px font size and other styles, so double-check that both size variants maintain proper contrast ratios and readability.

@@ -57,7 +57,7 @@ export const LinkCustom = ({
case variant === 'secondary':
return <ArrowIcon />;
case variant === 'rounded':
return <ArrowIcon size={16} />;
return <ArrowIcon />;
Copy link
Contributor

Choose a reason for hiding this comment

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

πŸ’‘ Verification agent

🧩 Analysis chain

Consider maintaining consistent icon sizing.

Removing the size prop for the 'rounded' variant while keeping it for other variants may lead to inconsistent icon sizes across different link styles.


🏁 Script executed:

#!/bin/bash
# Search for other ArrowIcon usages to verify size consistency
rg "ArrowIcon" -A 2 -B 2

Length of output: 2174


Fix Icon Sizing for Rounded Variant

  • The test expects a small-sized ArrowIcon for the 'rounded' variant, but the component currently renders <ArrowIcon /> without the size prop.
  • Please ensure that the size prop is explicitly set (e.g., <ArrowIcon size="small" />) for the 'rounded' variant or update the test to reflect the new design if intentional.

align-items: center;

height: 100%;
min-height: 112px;
padding: 0 24px;
padding: 36px 32px;
Copy link
Contributor

Choose a reason for hiding this comment

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

πŸ› οΈ Refactor suggestion

Review padding values.

Large padding values (32px, 36px) contribute to increased card size. Consider reducing to maintain compact design:

-    padding: 36px 32px;
+    padding: 24px 24px;

-    padding: 32px;
+    padding: 24px;

Also applies to: 64-64

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

Successfully merging this pull request may close these issues.

Course card design update
2 participants