fix(togglebutton component): fix togglebutton with long label in mobile
Fixed display of component with large label on mobile devices
fix #884 and fix #587
- [x] I have followed the Your First Code Contribution section of the Contributing guide
Fixed the display of the component with a large label on mobile devices. Now it does not collapse and is displayed correctly
https://github.com/themesberg/flowbite-react/issues/587 https://github.com/themesberg/flowbite-react/issues/884
Summary by CodeRabbit
-
New Features
- Enhanced the
ToggleSwitchcomponent with a new story for testing long labels.
- Enhanced the
-
Style Updates
- Updated the
ToggleSwitchcomponent styles to improve layout and sizing across small, medium, and large sizes.
- Updated the
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| flowbite-react | ❌ Failed (Inspect) | Apr 28, 2024 4:43pm | ||
| flowbite-react-storybook | ❌ Failed (Inspect) | Apr 28, 2024 4:43pm |
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 97.36%. Comparing base (
7461173) to head (3311292). Report is 245 commits behind head on main.
:exclamation: Current head 3311292 differs from pull request most recent head e67ddac. Consider uploading reports for the commit e67ddac to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## main #1199 +/- ##
==========================================
- Coverage 99.54% 97.36% -2.18%
==========================================
Files 163 214 +51
Lines 6621 9077 +2456
Branches 401 530 +129
==========================================
+ Hits 6591 8838 +2247
- Misses 30 239 +209
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@SutuSebastian can you please check my pr?
⚠️ No Changeset found
Latest commit: e67ddacbc579a5699a9583bc196208ee324a5c54
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Walkthrough
The recent updates focus on enhancing the ToggleSwitch component by adding a new story for testing long labels and updating styling to handle multi-line labels effectively. These changes aim to improve the component's responsiveness and visual integrity across different devices and scenarios.
Changes
| Files | Change Summary |
|---|---|
.../ToggleSwitch/ToggleSwitch.stories.tsx |
Added ToggleSwitchWithLongLabel story to test long labels. |
.../ToggleSwitch/theme.ts |
Updated toggle base style and sizes to better support long labels and prevent style collapsing. |
Assessment against linked issues
| Objective | Addressed | Explanation |
|---|---|---|
| Ensure ToggleSwitch styling remains intact on mobile with long labels (#884, #587) | ✅ | |
| Prevent ToggleSwitch from collapsing when label spans multiple lines (#884, #587) | ✅ |
Possibly related issues
- themesberg/flowbite-react#925: This PR does not directly address making label parameters optional, but the focus on label handling could indirectly benefit from such flexibility. Consider linking if label optionality is explored further.
Poem
🐰🌟 In the realm of UI so bright, A ToggleSwitch now holds the light. Long labels stretch, but do not break, Through screens small, a path they make. CodeRabbit hops with joy, you see, For styled toggles as they should be! 🌟🐰
Recent Review Details
Configuration used: CodeRabbit UI Review profile: CHILL
Commits
Files that changed from the base of the PR and between ee3749f4173d99b15bcbd6a312ddc5da69ba6fcf and e67ddacbc579a5699a9583bc196208ee324a5c54.Files selected for processing (2)
- src/components/ToggleSwitch/ToggleSwitch.stories.tsx (1 hunks)
- src/components/ToggleSwitch/theme.ts (2 hunks)
Files skipped from review due to trivial changes (1)
- src/components/ToggleSwitch/ToggleSwitch.stories.tsx
Additional comments not posted (2)
src/components/ToggleSwitch/theme.ts (2)
13-13: Ensure therelative shrink-0classes are visually verified.Nikitadubyk's comment suggests potential issues without
shrink-0. Please confirm the component's appearance with these classes, possibly referencing the linked visual evidence.
38-40: Adjustments to themin-w-classes in sizes are appropriate.These changes should help maintain the visual integrity of the
ToggleSwitchacross different device sizes, as intended.
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?
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>. -
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
@coderabbitaiin 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
@coderabbitaiin 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 generate interesting stats about this repository and render them as a table. -
@coderabbitai show all the console.log statements in this repository. -
@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.
-
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 as PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger a review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai helpto get help.
Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
CodeRabbit Configration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
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.
@SutuSebastian sorry for late update) I fix comments now
deprecated by #1428