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(dropdown): add show/hide events #301

Merged
merged 2 commits into from
Aug 2, 2024
Merged

Conversation

Flambe
Copy link
Contributor

@Flambe Flambe commented Jul 11, 2024

Add show/hide events when opening/closing the dropdown as it can be useful to perform actions when the dropdown is toggled

Summary by CodeRabbit

  • New Features
    • Introduced comprehensive API documentation for the dropdown component, detailing props, events, and slots.
    • Added new props for the dropdown component: placement, text, transition, closeInside, and alignToEnd.
    • Introduced show and hide events for improved interactivity of the dropdown component.
    • Added default and suffix slots to enhance dropdown customization.
    • Dropdown now emits 'show' and 'hide' events based on its visibility state for better parent component interaction.

Copy link

coderabbitai bot commented Jul 11, 2024

Walkthrough

The recent updates enhance the dropdown component with comprehensive API documentation, introducing new props, events, and slots. Additionally, the FwbDropdown.vue file has been modified to include a watch functionality that emits show and hide events based on the dropdown's visibility state, significantly improving interactivity and user experience.

Changes

Files Change Summary
docs/components/dropdown.md Added API documentation for props, events, and slots of the dropdown component.
src/components/FwbDropdown/FwbDropdown.vue Implemented watch to emit show and hide events based on visibility changes.

Poem

In the world of code, a dropdown blooms,
With props and slots, in ample rooms. 🌸
Events like show and hidden hide,
Now watched and known with open pride.
A bunny hops from line to line,
Delighting in this change divine! 🐇✨


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>.
    • 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 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.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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 Jul 11, 2024

Deploy Preview for sensational-seahorse-8635f8 ready!

Name Link
🔨 Latest commit f4384b8
🔍 Latest deploy log https://app.netlify.com/sites/sensational-seahorse-8635f8/deploys/66a8b2db45e122000829bd2a
😎 Deploy Preview https://deploy-preview-301--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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a0f04ed and 5c990da.

Files selected for processing (2)
  • docs/components/dropdown.md (1 hunks)
  • src/components/FwbDropdown/FwbDropdown.vue (2 hunks)
Additional comments not posted (6)
src/components/FwbDropdown/FwbDropdown.vue (3)

47-47: LGTM: Necessary imports added.

The added imports computed, ref, toRef, and watch from Vue are necessary for the new functionality and are correctly included.


77-81: LGTM: Necessary emits added.

The added emits for show and hide events are necessary to notify when the dropdown is shown or hidden and are correctly included.


82-91: LGTM: Watch block for visible state added.

The watch block for the visible state correctly emits show or hide events based on the visibility of the dropdown.

docs/components/dropdown.md (3)

263-270: LGTM: Props documentation added.

The added props placement, text, transition, closeInside, and alignToEnd are necessary for the new functionality and are correctly documented.


272-276: LGTM: Events documentation added.

The added events show and hide are necessary to notify when the dropdown is shown or hidden and are correctly documented.


278-282: LGTM: Slots documentation added.

The added slots default and suffix provide flexibility for customizing the dropdown content and are correctly documented.

@cogor cogor added 🔧 enhancement New feature or request ✨ good first issue Good for newcomers labels Jul 29, 2024
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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5c990da and f4384b8.

Files selected for processing (1)
  • src/components/FwbDropdown/FwbDropdown.vue (2 hunks)
Additional comments not posted (3)
src/components/FwbDropdown/FwbDropdown.vue (3)

47-47: LGTM!

The import statement for watch is correct and necessary for the new functionality.


77-80: LGTM!

The emit declaration for show and hide events is correct and aligns with the new functionality.


Line range hint 47-92:
LGTM!

The changes integrate well within the existing code structure, enhancing the functionality of the dropdown component.

Comment on lines +82 to +91
watch(
visible,
(isVisible: boolean) => {
if (isVisible) {
emit('show')
} else {
emit('hide')
}
},
)
Copy link

@coderabbitai coderabbitai bot Jul 30, 2024

Choose a reason for hiding this comment

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

LGTM! Ensure proper test coverage.

The watch function is well-implemented and enhances the component's interactivity by emitting show and hide events based on the visible state. Ensure that this new functionality is covered by tests.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i believe it's out of the scope of the PR to set up a bunch of new tests. but a task for testing in general is up to the maintainers, not me

Copy link

Choose a reason for hiding this comment

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

@Flambe, understood. I'll go ahead and open a GitHub issue to track the task of adding tests for the show and hide events. This will ensure that the new functionality is properly covered in the future.

Would you like me to proceed with creating the issue?


Learnings added
Learnt from: Flambe
PR: themesberg/flowbite-vue#301
File: src/components/FwbDropdown/FwbDropdown.vue:82-91
Timestamp: 2024-07-30T09:40:49.346Z
Learning: When a user indicates that setting up new tests is out of the scope of a PR, offer to open a GitHub issue to track the task of adding the necessary tests.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Copy link
Collaborator

@Sqrcz Sqrcz left a comment

Choose a reason for hiding this comment

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

This can be really handy... thank you!

And thanks for updating the documentation.

@Sqrcz Sqrcz merged commit 4ebd52d into themesberg:main Aug 2, 2024
11 checks passed
@Flambe Flambe deleted the dropdown-events branch August 19, 2024 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔧 enhancement New feature or request ✨ good first issue Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants