-
Notifications
You must be signed in to change notification settings - Fork 260
feat: added close callout btn #933
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
Conversation
WalkthroughThe changes introduce a close button functionality to the Changes
Possibly related PRs
Suggested reviewers
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
|
✅ Deploy Preview for docs-optimism ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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
🧹 Outside diff range and nitpick comments (2)
styles/global.css (1)
78-92
: Close button implemented, consider improving mobile usabilityThe new
.callout-close-btn
class successfully implements the close button for callouts as per the PR objective:
- Absolute positioning ensures consistent placement at the top-right corner.
- The circular design and color scheme are appropriate for a close button.
However, the button's small size (25x25px) might be difficult to interact with on mobile devices. Consider the following improvements:
- Increase the button size for better touch targets on mobile:
- width: 25px; - height: 25px; + width: 44px; + height: 44px;
- Add a media query to adjust the button size for larger screens:
@media (min-width: 768px) { .callout-close-btn { width: 25px; height: 25px; } }
- Consider adding a hover effect for desktop users:
.callout-close-btn:hover { background-color: #ffdc00; cursor: pointer; }components/WipCallout.tsx (1)
44-49
: Close button added, but consider improving accessibilityThe close button is correctly implemented with the appropriate onClick event handler. However, to improve accessibility:
- Add an
aria-label
attribute to describe the button's function.- Consider using a more descriptive text or an icon with alt text instead of just 'x'.
Here's a suggested improvement:
<button - className="callout-close-btn" + className="callout-close-btn" + aria-label="Close callout" onClick={() => setCloseCallout(true)} > - x + Close </button>
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (2)
- components/WipCallout.tsx (4 hunks)
- styles/global.css (1 hunks)
🔇 Additional comments (7)
styles/global.css (2)
57-92
: Overall implementation aligns with PR objectiveThe changes successfully implement the close button for callouts as described in the PR objective. The modifications to
div.custom-callouts
and the new.callout-close-btn
class work together to create a functional and visually consistent feature.To further enhance the implementation, consider:
- Addressing the potential mobile layout issues by re-introducing a media query for smaller screens.
- Improving the close button's usability on mobile devices by adjusting its size and adding touch-friendly interactions.
These refinements will ensure a better user experience across all devices while maintaining the intended functionality.
57-60
: Improved callout visibility, but consider mobile layoutThe changes to
div.custom-callouts
enhance the visibility and user experience:
- Sticky positioning keeps the callout visible while scrolling.
- Adjusted top value and padding improve spacing.
- High z-index (9999) ensures the callout appears above other elements.
However, the removal of the media query for screens below 767px might affect the layout on smaller devices.
To ensure proper mobile layout, please run the following script:
Also applies to: 63-63
components/WipCallout.tsx (5)
13-13
: LGTM: useState import added correctlyThe addition of the useState import is appropriate for the new state management in the WipCallout component.
19-19
: LGTM: State variable for close functionality addedThe
closeCallout
state variable is correctly implemented using the useState hook. This will effectively manage the visibility of the callout.
21-25
: LGTM: Conditional class for hiding callout implemented correctlyThe conditional application of the 'nx-hidden' class based on the
closeCallout
state is well-implemented. This will effectively hide the callout when the close button is clicked.
62-67
: LGTM: Text updates in InfoCallout and AltCalloutThe text modifications in both InfoCallout and AltCallout components improve the clarity of the messages. These changes don't affect functionality and provide better information to users.
Also applies to: 84-89
Line range hint
1-93
: Summary: Close button functionality added successfullyThe implementation of the close button in the WipCallout component is well-done and aligns with the PR objectives. The state management and conditional rendering are implemented correctly.
To ensure the robustness of this new feature:
- Consider adding unit tests for the WipCallout component to verify the close functionality.
- Implement end-to-end tests to confirm the button works as expected in the actual UI.
To verify the implementation, you can run the following commands:
This will help identify any existing tests and determine where new tests should be added.
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.
Looks great! As long as the button is actually clickable on mobile and you check out my small comment, this looks great to me! Thanks!!
Can confirm the button works on mobile btw |
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.
✅
@bradleycamacho please approval and merge. |
added callout close btn
Screen.Recording.2024-09-26.at.8.40.24.PM.mov