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

feat: add support for using tooltips on buttons that are inside a but… #336

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tho-dan
Copy link

@tho-dan tho-dan commented Dec 10, 2024

When a button is wrapped in the <fwb-tooltip> component, it broke the grouping previously.

Summary by CodeRabbit

  • New Features

    • Added a new example for the tooltip component demonstrating its use within a button group.
    • Introduced a new Vue component showcasing buttons with tooltips.
  • Bug Fixes

    • Enhanced button styling within tooltips to ensure consistency with button groups.
  • Documentation

    • Updated documentation to include a new section and example for tooltip integration with buttons.

Copy link

coderabbitai bot commented Dec 10, 2024

Walkthrough

The changes in this pull request involve enhancements to the tooltip component documentation and its associated examples. A new example component, FwbTooltipExampleGroup, is introduced to demonstrate the integration of tooltips within a button group. Additionally, the styling of buttons in the FwbButtonGroup component is updated to ensure consistent appearance when used within tooltips. The FwbTooltip component's template structure is also modified to include a specific class for improved styling.

Changes

File Path Change Summary
docs/components/tooltip.md Added import statement for FwbTooltipExampleGroup and a new section titled "Inside of Button Group" with example code.
docs/components/tooltip/examples/FwbTooltipExampleGroup.vue Introduced new Vue component FwbTooltipExampleGroup showcasing button group with tooltips.
src/components/FwbButtonGroup/FwbButtonGroup.vue Updated CSS styles for buttons to include those within .fwb-tooltip, ensuring consistent rounded styles.
src/components/FwbTooltip/FwbTooltip.vue Modified template structure by adding class fwb-tooltip to the main tooltip container.

Poem

In a garden of buttons, so bright and so round,
Tooltips now dance, with a soft, gentle sound.
A group of them gathered, in style they unite,
With examples of usage, oh what a delight!
Hopping with joy, we celebrate this change,
In the world of tooltips, it's all rearranged! 🐇✨


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. (Experiment)
  • @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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file 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.

Copy link

netlify bot commented Dec 10, 2024

Deploy Preview for sensational-seahorse-8635f8 ready!

Name Link
🔨 Latest commit 788f73a
🔍 Latest deploy log https://app.netlify.com/sites/sensational-seahorse-8635f8/deploys/67586135b1d45100080a9641
😎 Deploy Preview https://deploy-preview-336--sensational-seahorse-8635f8.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

@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: 0

🧹 Outside diff range and nitpick comments (3)
src/components/FwbButtonGroup/FwbButtonGroup.vue (1)

11-22: LGTM! Consider documenting the tooltip support.

The CSS selectors correctly handle buttons within tooltips, maintaining consistent button group styling. Consider adding a comment to document this support for future maintainers.

+/* Support for buttons wrapped in tooltips while maintaining button group styling */
 .fwb-button-group > button,
 .fwb-button-group > .fwb-tooltip button {
   @apply rounded-none;
 }
docs/components/tooltip/examples/FwbTooltipExampleGroup.vue (1)

1-23: Consider enhancing the example with more variations.

The example effectively demonstrates the basic usage. Consider adding variations to showcase:

  • Different tooltip placements (left/right/bottom)
  • Multiple tooltips in the same button group
  • Different themes (light/dark)

Example enhancement:

 <fwb-button-group>
   <fwb-button>
     Normal Button
   </fwb-button>
   <fwb-tooltip>
     <template #trigger>
       <fwb-button>
         Button With Tooltip
       </fwb-button>
     </template>
     <template #content>
       Tooltip content
     </template>
   </fwb-tooltip>
+  <fwb-tooltip placement="bottom" theme="light">
+    <template #trigger>
+      <fwb-button>
+        Another Tooltip
+      </fwb-button>
+    </template>
+    <template #content>
+      Light theme tooltip
+    </template>
+  </fwb-tooltip>
 </fwb-button-group>
docs/components/tooltip.md (1)

123-123: Consider enhancing the documentation with additional details.

The description could be more comprehensive. Consider adding:

  • Any styling considerations or limitations
  • Examples of different tooltip placements within button groups
  • Best practices for accessibility

Example enhancement:

-You can use the tooltip component inside of the button group component.
+You can use the tooltip component inside of the button group component while maintaining proper button grouping and styling. This is particularly useful for adding explanatory tooltips to specific buttons within a group while preserving the group's visual cohesion. Note that tooltip triggers work independently for each button in the group.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between affa35a and 788f73a.

📒 Files selected for processing (4)
  • docs/components/tooltip.md (2 hunks)
  • docs/components/tooltip/examples/FwbTooltipExampleGroup.vue (1 hunks)
  • src/components/FwbButtonGroup/FwbButtonGroup.vue (1 hunks)
  • src/components/FwbTooltip/FwbTooltip.vue (1 hunks)
🔇 Additional comments (3)
src/components/FwbTooltip/FwbTooltip.vue (1)

2-2: LGTM! Verify class usage across codebase.

The addition of the fwb-tooltip class is appropriate for styling integration with button groups.

✅ Verification successful

LGTM! The fwb-tooltip class is correctly used

The fwb-tooltip class is properly integrated and serves a specific purpose in the component system:

  • It's used in FwbTooltip component to provide the base structure
  • FwbButtonGroup styles specifically target this class to handle button border radius when tooltips are used within button groups
  • The implementation is consistent with the component's intended functionality
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the fwb-tooltip class usage
rg "fwb-tooltip" --type vue

Length of output: 55


Script:

#!/bin/bash
# Search for fwb-tooltip class usage in all files
rg "fwb-tooltip"

# Also search for files with .vue extension to ensure we're searching in the right place
fd "\.vue$"

Length of output: 19349


Script:

#!/bin/bash
# Let's check the content of FwbButtonGroup.vue to understand how fwb-tooltip is used
cat src/components/FwbButtonGroup/FwbButtonGroup.vue

# Also check the content of FwbTooltip.vue to see the complete implementation
cat src/components/FwbTooltip/FwbTooltip.vue

Length of output: 2663

docs/components/tooltip.md (2)

5-5: LGTM! Import statement follows established patterns.

The import statement for FwbTooltipExampleGroup is well-structured and consistent with other example imports.


121-148: LGTM! Well-structured documentation for the new feature.

The new section effectively demonstrates how to use tooltips within button groups, with clear examples and implementation details.

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.

1 participant