-
-
Notifications
You must be signed in to change notification settings - Fork 839
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
[REFACTOR] CSS for PostCard.tsx #3006
[REFACTOR] CSS for PostCard.tsx #3006
Conversation
WalkthroughThis pull request focuses on refactoring the CSS for the PostCard component by removing the Changes
Assessment against linked issues
Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
There was a problem hiding this 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 (5)
src/style/app.module.css (5)
3528-3534
: Consider making the card width responsive.The fixed width of
20rem
might cause layout issues on smaller screens. Consider using:
- Fluid units like percentage or viewport units
- Media queries to adjust width based on screen size
- min/max width constraints for better control
.cardStyles { - width: 20rem; + width: 100%; + max-width: 20rem; background-color: var(--bs-white); padding: 0; border: none !important; outline: none !important; }
3548-3565
: Use relative units for SVG dimensions.The hardcoded SVG dimensions might not scale well across different screen sizes.
.creator svg { - width: 2rem; - height: 2rem; + width: 1.5em; + height: 1.5em; }
3585-3619
: Improve text readability.Text justification (
text-align: justify
) can create uneven word spacing and affect readability. Consider using left alignment instead..cardText { --max-lines: 2; display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: var(--max-lines); padding-top: 0; font-weight: 300; margin-top: 0.7rem !important; - text-align: justify; + text-align: left; }
3620-3652
: Add transition effect for outline.The outline appears abruptly on focus. Consider adding a smooth transition.
.cardActionBtn { background-color: rgba(0, 0, 0, 0); padding: 0; border: none; color: black; - transition: background-color 0.2s ease; + transition: all 0.2s ease; }
3701-3704
: Improve image handling.The fixed height for post images might cause aspect ratio distortion. Consider using aspect-ratio property or maintaining aspect ratio through padding technique.
.postImage { - height: 300px; + width: 100%; + aspect-ratio: 16/9; object-fit: cover; }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/components/UserPortal/PostCard/PostCard.module.css
(0 hunks)src/components/UserPortal/PostCard/PostCard.tsx
(4 hunks)src/style/app.module.css
(2 hunks)
💤 Files with no reviewable changes (1)
- src/components/UserPortal/PostCard/PostCard.module.css
✅ Files skipped from review due to trivial changes (1)
- src/components/UserPortal/PostCard/PostCard.tsx
🔇 Additional comments (2)
src/style/app.module.css (2)
3536-3546
: LGTM! Well-structured header styles.
The header styles follow best practices with proper use of flexbox, CSS variables, and consistent spacing.
3566-3584
: LGTM! Accessible toggle button styles.
The toggle button styles follow accessibility best practices with proper hover and focus states.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop-postgres #3006 +/- ##
=====================================================
+ Coverage 29.27% 88.92% +59.65%
=====================================================
Files 300 321 +21
Lines 7546 8408 +862
Branches 1646 1893 +247
=====================================================
+ Hits 2209 7477 +5268
+ Misses 5154 688 -4466
- Partials 183 243 +60 ☔ View full report in Codecov by Sentry. |
|
…wa-admin into refactor-issue-post
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (4)
src/style/app.module.css (4)
3610-3617
: Consider improving card responsiveness and avoiding !important.The card structure could be enhanced:
- Consider using media queries for responsive max-width on smaller screens.
- Avoid using
!important
for border/outline - try increasing specificity instead..cardStyles { width: 100%; - max-width: 20rem; + max-width: min(20rem, 100%); background-color: var(--bs-white); padding: 0; - border: none !important; - outline: none !important; + border: 0; + outline: 0; } +@media (max-width: 480px) { + .cardStyles { + max-width: 100%; + } +}
3619-3667
: Enhance header interactivity and maintainability.Consider these improvements:
- Add hover state for creator name to improve interactivity.
- Use CSS variables for colors to maintain consistency.
.creator p { margin-bottom: 0; font-weight: 500; + cursor: pointer; + transition: color 0.2s ease; } +.creator p:hover { + color: var(--subtle-blue-grey); +} .customToggle svg { - color: var(--bs-black); + color: var(--brown-color); }
3668-3701
: Add fallbacks and loading states.Consider these improvements:
- Add fallback for browsers that don't support line clamping.
- Add loading state for images.
.cardTitlePostCard { --max-lines: 1; display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: var(--max-lines); + /* Fallback for browsers that don't support line clamping */ + @supports not (-webkit-line-clamp: var(--max-lines)) { + white-space: nowrap; + text-overflow: ellipsis; + } } .imageContainerPostCard { max-width: 100%; + position: relative; + min-height: 200px; /* Placeholder height while loading */ + background-color: var(--grey-bg-color); }
3736-3787
: Enhance modal scrolling experience.The modal styles could be improved:
- Use dynamic height for comment container based on viewport.
- Add custom scrollbar styles for better UX.
.commentContainer { overflow: auto; - max-height: 18rem; + max-height: min(18rem, 50vh); padding-bottom: 1rem; + scrollbar-width: thin; + scrollbar-color: var(--subtle-blue-grey) transparent; } + +.commentContainer::-webkit-scrollbar { + width: 6px; +} + +.commentContainer::-webkit-scrollbar-track { + background: transparent; +} + +.commentContainer::-webkit-scrollbar-thumb { + background-color: var(--subtle-blue-grey); + border-radius: 3px; +}
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/components/UserPortal/PostCard/PostCard.tsx
(6 hunks)src/style/app.module.css
(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/components/UserPortal/PostCard/PostCard.tsx
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this 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 (5)
src/style/app.module.css (5)
3610-3617
: Improve card responsiveness and accessibilityConsider these improvements:
- Make the width more responsive for smaller screens
- Preserve focus styles for keyboard navigation
.cardStyles { - width: 100%; - max-width: 20rem; + width: clamp(15rem, 100%, 20rem); background-color: var(--bs-white); padding: 0; - border: none !important; - outline: none !important; + border: none; + outline: none; } +.cardStyles:focus-visible { + outline: 2px solid var(--subtle-blue-grey); + outline-offset: 2px; +}
3631-3648
: Use CSS variables for consistent icon sizingConsider extracting icon dimensions into CSS variables for better maintainability.
+:root { + --icon-size-md: 1.5rem; +} .creator svg { - width: 1.5rem; - height: 1.5rem; + width: var(--icon-size-md); + height: var(--icon-size-md); }
3668-3671
: Use CSS variables for consistent spacingConsider using CSS variables for padding to maintain consistent spacing throughout the component.
+:root { + --spacing-sm: 0.5rem; +} .cardBodyPostCard div { - padding: 0.5rem; + padding: var(--spacing-sm); }
3672-3675
: Enhance image container stylesConsider adding styles to handle image aspect ratio and loading behavior.
.imageContainerPostCard { max-width: 100%; + position: relative; + aspect-ratio: 16/9; + background-color: var(--grey-bg-color); }
3740-3792
: Use CSS variables for modal dimensionsConsider extracting modal dimensions into CSS variables for better maintainability.
+:root { + --modal-comment-max-height: 18rem; + --modal-footer-padding: 0.5rem; +} .commentContainer { overflow: auto; - max-height: 18rem; + max-height: var(--modal-comment-max-height); padding-bottom: 1rem; } .modalFooter { background-color: var(--bs-white); width: 100%; - padding-block: 0.5rem; + padding-block: var(--modal-footer-padding); display: flex; flex-direction: column; border-top: 1px solid var(--input-shadow-color); }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/style/app.module.css
(2 hunks)
🔇 Additional comments (4)
src/style/app.module.css (4)
3619-3629
: LGTM!
The card header implementation uses flexbox effectively with proper spacing and alignment.
3649-3667
: LGTM!
The toggle button implementation properly handles default styles and interaction states.
3676-3685
: LGTM!
The card title implementation properly handles text truncation using line clamping.
3686-3739
: Button accessibility and interaction states were previously addressed
The implementation of button interaction states matches the previous review comment.
2e2e8ef
into
PalisadoesFoundation:develop-postgres
@palisadoes May you please assign me a issue to work on, something in your mind that to be done next, because almost all the issues created are assigned. Thankyou. |
Check slack |
What kind of change does this PR introduce?
Streamlined all CSS for PostCard.tsx into a single global file, fixed UI bugs on the PostCard.tsx , and ensured no conflicts with other pages.
Issue Number:
Fixes #2895
Did you add tests for your changes?
No
Does this PR introduce a breaking change?
No
Have you read the contributing guide?
Yes
Summary by CodeRabbit
Release Notes
New Features
Styling Updates
Refactor
These changes aim to improve the visual presentation and maintainability of the post card interface.