Skip to content

feat(FwbListGroupItem): Add href and to support #382

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

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

Conversation

MahmoudGhalayini
Copy link

@MahmoudGhalayini MahmoudGhalayini commented May 8, 2025

Add automatic hover effect detection and improve link handling in FwbListGroupItem

This commit enhances the FwbListGroupItem component with two key improvements:

  1. Automatic hover styling when a click event handler is attached, without requiring an explicit prop. The component now checks for the presence of click event handlers in the component attributes.

  2. Comprehensive link support with proper handling of:

    • External links via href attribute
    • Router links via to attribute
    • Support for both router-link and nuxt-link tags
    • Proper target attribute handling for external links

Summary by CodeRabbit

  • Documentation

    • Updated examples and documentation to demonstrate using list group items as links with new props (href, to, target) instead of the removed hover prop.
    • Clarified usage of link-related props in list group items and improved example clarity for navigation and external links.
  • New Features

    • List group items now support direct navigation via href, to, and target props, allowing for both external and router links.
    • Items automatically display hover effects when acting as links or when a click event is present.
  • Refactor

    • Simplified and consolidated markup in documentation examples for dropdowns and button groups, reducing complexity and improving readability.
    • Enhanced list group item component to dynamically render appropriate tags and attributes based on link or action presence for consistent styling and behavior.

Copy link

netlify bot commented May 8, 2025

Deploy Preview for sensational-seahorse-8635f8 ready!

Name Link
🔨 Latest commit 65d686a
🔍 Latest deploy log https://app.netlify.com/sites/sensational-seahorse-8635f8/deploys/681f64b8df2f7d00082fc8a8
😎 Deploy Preview https://deploy-preview-382--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
Contributor

coderabbitai bot commented May 8, 2025

Walkthrough

The changes refactor the list group item component and its documentation to support direct link and router-link functionality through new props (href, to, target, tag), removing the previous hover prop. Example usages and documentation are updated to demonstrate these new link behaviors, simplifying markup and clarifying interactive intent.

Changes

File(s) Change Summary
src/components/FwbListGroup/FwbListGroupItem.vue Refactored component to render as a dynamic tag based on new href, to, target, and tag props. Removed hover prop and replaced with computed logic for hover state. Added computed properties for link detection and tag selection. Updated to support anchor, router-link, and plain tags with appropriate attributes.
docs/components/list-group.md
docs/components/listGroup/examples/FwbListGroupExampleLink.vue
Updated documentation and example to show new link-related props (href, to, target) instead of hover. Renamed section from "Hover" to "Links" and clarified usage of link props. Example demonstrates active links, external links, router links, and regular items.
docs/components/button-group.md
docs/components/buttonGroup/examples/FwbButtonGroupExampleDropdown.vue
Simplified dropdown example by removing nested anchor tags and the hover prop. List group items now use href directly for link behavior, reducing markup complexity.
docs/components/dropdown.md
docs/components/dropdown/examples/FwbDropdownExampleListGroup.vue
Updated dropdown examples to use to, href, and click event props for list group items instead of styling-based hover cues. Added a stub signOut function for the click handler. Examples now reflect semantic navigation and action triggers.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ListGroupItem
    participant Router
    participant Browser

    User->>ListGroupItem: Clicks on item
    alt Item has "to" prop
        ListGroupItem->>Router: Navigate via router-link
    else Item has "href" prop
        ListGroupItem->>Browser: Navigate to external link
    else Item has @click handler
        ListGroupItem->>ListGroupItem: Execute click handler
    else
        ListGroupItem->>ListGroupItem: No action (regular item)
    end
Loading

Possibly related PRs

Suggested reviewers

  • Sqrcz

Poem

A hop, a leap, a code refactor,
Now links are clear—no markup clatter!
With href and to, our paths are bright,
No more hover in the night.
Docs and examples, neat and new,
🐇 Cheers for code that hops right through!

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fd0e40e and 65d686a.

📒 Files selected for processing (7)
  • docs/components/button-group.md (1 hunks)
  • docs/components/buttonGroup/examples/FwbButtonGroupExampleDropdown.vue (1 hunks)
  • docs/components/dropdown.md (1 hunks)
  • docs/components/dropdown/examples/FwbDropdownExampleListGroup.vue (2 hunks)
  • docs/components/list-group.md (2 hunks)
  • docs/components/listGroup/examples/FwbListGroupExampleLink.vue (1 hunks)
  • src/components/FwbListGroup/FwbListGroupItem.vue (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/components/button-group.md
🚧 Files skipped from review as they are similar to previous changes (6)
  • docs/components/buttonGroup/examples/FwbButtonGroupExampleDropdown.vue
  • docs/components/list-group.md
  • docs/components/listGroup/examples/FwbListGroupExampleLink.vue
  • docs/components/dropdown/examples/FwbDropdownExampleListGroup.vue
  • docs/components/dropdown.md
  • src/components/FwbListGroup/FwbListGroupItem.vue

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

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
Contributor

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

🧹 Nitpick comments (3)
docs/components/listGroup/examples/FwbListGroupExampleLink.vue (1)

7-9: Correct the target attribute value.

The target attribute value should be "_blank" (single underscore) instead of "__blank" (double underscore) to comply with HTML standards.

-      <fwb-list-group-item href="https://flowbite.com" target="__blank">
+      <fwb-list-group-item href="https://flowbite.com" target="_blank">
docs/components/list-group.md (1)

54-56: Fix inconsistency in router link example.

There's an inconsistency between the documentation example and the actual component. The documentation shows to="#" while the component example uses to="/some-route". Consider using a more realistic path that mirrors the component example.

-    <fwb-list-group-item to="#">
+    <fwb-list-group-item to="/some-route">
src/components/FwbListGroup/FwbListGroupItem.vue (1)

65-70: Consider more flexible approach for determining link attribute.

Currently, linkAttr only checks for "router-link" and "nuxt-link" tags. Consider a more flexible approach that could accommodate custom components that also use the "to" prop.

-const linkAttr = computed(() => {
-  if (!isLink.value) return null;
-  return props.tag === "router-link" || props.tag === "nuxt-link"
-    ? "to"
-    : "href";
-});
+const linkAttr = computed(() => {
+  if (!isLink.value) return null;
+  // If using to prop and a component that likely uses to, use to attribute
+  if (props.to && (props.tag !== "a" && props.tag !== "li")) {
+    return "to";
+  }
+  // Otherwise default to href for links
+  return "href";
+});
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 570e238 and 23f51c2.

📒 Files selected for processing (8)
  • docs/components/button-group.md (1 hunks)
  • docs/components/buttonGroup/examples/FwbButtonGroupExampleDropdown.vue (1 hunks)
  • docs/components/dropdown.md (1 hunks)
  • docs/components/dropdown/examples/FwbDropdownExampleListGroup.vue (2 hunks)
  • docs/components/list-group.md (2 hunks)
  • docs/components/listGroup/examples/FwbListGroupExampleHover.vue (0 hunks)
  • docs/components/listGroup/examples/FwbListGroupExampleLink.vue (1 hunks)
  • src/components/FwbListGroup/FwbListGroupItem.vue (2 hunks)
💤 Files with no reviewable changes (1)
  • docs/components/listGroup/examples/FwbListGroupExampleHover.vue
🔇 Additional comments (10)
docs/components/buttonGroup/examples/FwbButtonGroupExampleDropdown.vue (1)

13-17: Implementation looks good - clean and simplified markup!

The list group items now directly use the href attribute instead of nested anchor tags, making the markup cleaner and more semantic. This takes advantage of the enhanced FwbListGroupItem component that now supports link functionality.

docs/components/button-group.md (1)

83-87: Documentation updated correctly to match implementation

The code examples in the documentation have been properly updated to use the direct href attributes on list group items, matching the implementation changes. This ensures documentation and code remain in sync.

docs/components/dropdown.md (1)

147-158: Great demonstration of the different use cases

This example effectively showcases the component's versatility by demonstrating:

  1. Router link navigation with to="#" (line 147)
  2. External links with href="#" (lines 150, 153)
  3. Click event handling with @click="signOut" (line 156)

The implementation is clean and provides good examples of all supported use cases.

docs/components/dropdown/examples/FwbDropdownExampleListGroup.vue (2)

8-19: Good implementation showing all navigation patterns

The changes effectively demonstrate the three different navigation patterns:

  1. Router navigation with to="my-dashboard"
  2. External links with href="#"
  3. Click event handling with @click="signOut"

This showcases the flexibility of the enhanced FwbListGroupItem component.


27-27: Empty signOut implementation is appropriate for this example

The empty signOut function serves as a placeholder for demonstration purposes. This is appropriate for an example component where the actual sign-out functionality would be implemented in a real application.

docs/components/listGroup/examples/FwbListGroupExampleLink.vue (1)

1-14: Well-structured example demonstrating all link scenarios.

The example effectively showcases the four main use cases of the enhanced component:

  1. An active link with href
  2. An external link with target attribute
  3. A router link with the to prop
  4. A regular non-link item without hover effect

This makes the component's new capabilities clear to users.

docs/components/list-group.md (1)

39-43: Clear and concise explanation of the new link functionality.

The tip provides a good explanation of when to use each prop (href for external links, to for router links, and target for setting the target attribute). The note about automatic hover effect is particularly helpful for users migrating from the previous version.

src/components/FwbListGroup/FwbListGroupItem.vue (3)

2-7: Well-implemented dynamic component rendering.

The dynamic component implementation elegantly handles multiple rendering scenarios (regular item, external link, router link) with a single template. The conditional attribute binding ensures that the appropriate link attribute (href or to) is used, and the target attribute is only applied when needed.


33-49: Good implementation of new props with appropriate defaults.

The new props are well-defined with appropriate types and default values. The null defaults for to and href allow for clear conditional logic based on their presence.


76-81: Great implementation of automatic hover detection.

The automatic hover detection (based on link presence or click handler) is an elegant solution that simplifies the API by removing the need for an explicit hover prop. This improves the developer experience while maintaining backward compatibility.

@Sqrcz Sqrcz self-assigned this May 9, 2025
@Sqrcz Sqrcz added 🔧 enhancement New feature or request ✨ good first issue Good for newcomers labels May 9, 2025
@Sqrcz
Copy link
Collaborator

Sqrcz commented May 9, 2025

Looks great. Very needed features. Thank you!

There may be some linting issue on the first glance... I'll take a proper look and make thorough review early next week.

Copy link
Contributor

@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

🧹 Nitpick comments (3)
docs/components/listGroup/examples/FwbListGroupExampleLink.vue (2)

7-9: Fix the target attribute value

The target attribute should be "_blank" (single underscore) instead of "__blank" (double underscore). This is the standard HTML attribute value for opening links in a new tab.

-      <fwb-list-group-item href="https://flowbite.com" target="__blank">
+      <fwb-list-group-item href="https://flowbite.com" target="_blank">

16-18: Fix linting error with semicolon

There's a linting error regarding an extra semicolon.

-import { FwbListGroup, FwbListGroupItem } from '../../../../src/index';
+import { FwbListGroup, FwbListGroupItem } from '../../../../src/index'
🧰 Tools
🪛 ESLint

[error] 17-17: Extra semicolon.

(@stylistic/semi)

src/components/FwbListGroup/FwbListGroupItem.vue (1)

25-27: Fix import order and remove extra semicolons

There are linting errors regarding the import order and unnecessary semicolons throughout the file.

-import { computed, resolveComponent, useAttrs, toRef } from 'vue';
+import { computed, resolveComponent, toRef, useAttrs } from 'vue'

-import { useListGroupItemClasses } from './composables/useListGroupItemClasses';
+import { useListGroupItemClasses } from './composables/useListGroupItemClasses'

Note: Similar semicolon issues exist throughout the file and should be addressed.

🧰 Tools
🪛 ESLint

[error] 25-25: Member 'toRef' of the import declaration should be sorted alphabetically.

(sort-imports)


[error] 25-25: Extra semicolon.

(@stylistic/semi)


[error] 27-27: Extra semicolon.

(@stylistic/semi)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 92d1f42 and 9d6ca45.

📒 Files selected for processing (8)
  • docs/components/button-group.md (1 hunks)
  • docs/components/buttonGroup/examples/FwbButtonGroupExampleDropdown.vue (1 hunks)
  • docs/components/dropdown.md (1 hunks)
  • docs/components/dropdown/examples/FwbDropdownExampleListGroup.vue (2 hunks)
  • docs/components/list-group.md (2 hunks)
  • docs/components/listGroup/examples/FwbListGroupExampleHover.vue (0 hunks)
  • docs/components/listGroup/examples/FwbListGroupExampleLink.vue (1 hunks)
  • src/components/FwbListGroup/FwbListGroupItem.vue (3 hunks)
💤 Files with no reviewable changes (1)
  • docs/components/listGroup/examples/FwbListGroupExampleHover.vue
🚧 Files skipped from review as they are similar to previous changes (5)
  • docs/components/buttonGroup/examples/FwbButtonGroupExampleDropdown.vue
  • docs/components/button-group.md
  • docs/components/dropdown.md
  • docs/components/list-group.md
  • docs/components/dropdown/examples/FwbDropdownExampleListGroup.vue
🧰 Additional context used
🪛 ESLint
docs/components/listGroup/examples/FwbListGroupExampleLink.vue

[error] 17-17: Extra semicolon.

(@stylistic/semi)

src/components/FwbListGroup/FwbListGroupItem.vue

[error] 25-25: Member 'toRef' of the import declaration should be sorted alphabetically.

(sort-imports)


[error] 25-25: Extra semicolon.

(@stylistic/semi)


[error] 27-27: Extra semicolon.

(@stylistic/semi)


[error] 29-29: Extra semicolon.

(@stylistic/semi)


[error] 55-55: Extra semicolon.

(@stylistic/semi)


[error] 57-57: Extra semicolon.

(@stylistic/semi)


[error] 58-58: Extra semicolon.

(@stylistic/semi)


[error] 60-60: Must use .value to read or write the value wrapped by computed().

(vue/no-ref-as-operand)


[error] 61-61: Extra semicolon.

(@stylistic/semi)


[error] 63-63: Extra semicolon.

(@stylistic/semi)


[error] 64-64: Extra semicolon.

(@stylistic/semi)


[error] 66-66: Extra semicolon.

(@stylistic/semi)


[error] 68-68: Extra semicolon.

(@stylistic/semi)


[error] 70-70: Extra semicolon.

(@stylistic/semi)


[error] 71-71: Extra semicolon.

(@stylistic/semi)


[error] 73-73: Extra semicolon.

(@stylistic/semi)


[error] 74-74: Must use .value to read or write the value wrapped by computed().

(vue/no-ref-as-operand)


[error] 76-76: Extra semicolon.

(@stylistic/semi)


[error] 77-77: Extra semicolon.

(@stylistic/semi)


[error] 78-78: Extra semicolon.

(@stylistic/semi)


[error] 79-79: Extra semicolon.

(@stylistic/semi)


[error] 81-81: Extra semicolon.

(@stylistic/semi)


[error] 82-82: Extra semicolon.

(@stylistic/semi)


[error] 83-83: Extra semicolon.

(@stylistic/semi)


[error] 85-85: Extra semicolon.

(@stylistic/semi)

🔇 Additional comments (4)
docs/components/listGroup/examples/FwbListGroupExampleLink.vue (1)

3-12: Well-structured example showcasing all link variations

This example effectively demonstrates the different ways the list group item can be used with the new link capabilities: as an active link, external link, router link, and regular item. Good job providing a comprehensive example!

src/components/FwbListGroup/FwbListGroupItem.vue (3)

57-83: Excellent implementation of link support

The refactoring of this component to support both standard HTML links and router links is well-implemented. The computed properties effectively determine the component's behavior based on the provided props. The automatic hover detection based on link status or click handlers is a particularly nice touch that will improve developer experience.

🧰 Tools
🪛 ESLint

[error] 57-57: Extra semicolon.

(@stylistic/semi)


[error] 58-58: Extra semicolon.

(@stylistic/semi)


[error] 60-60: Must use .value to read or write the value wrapped by computed().

(vue/no-ref-as-operand)


[error] 61-61: Extra semicolon.

(@stylistic/semi)


[error] 63-63: Extra semicolon.

(@stylistic/semi)


[error] 64-64: Extra semicolon.

(@stylistic/semi)


[error] 66-66: Extra semicolon.

(@stylistic/semi)


[error] 68-68: Extra semicolon.

(@stylistic/semi)


[error] 70-70: Extra semicolon.

(@stylistic/semi)


[error] 71-71: Extra semicolon.

(@stylistic/semi)


[error] 73-73: Extra semicolon.

(@stylistic/semi)


[error] 74-74: Must use .value to read or write the value wrapped by computed().

(vue/no-ref-as-operand)


[error] 76-76: Extra semicolon.

(@stylistic/semi)


[error] 77-77: Extra semicolon.

(@stylistic/semi)


[error] 78-78: Extra semicolon.

(@stylistic/semi)


[error] 79-79: Extra semicolon.

(@stylistic/semi)


[error] 81-81: Extra semicolon.

(@stylistic/semi)


[error] 82-82: Extra semicolon.

(@stylistic/semi)


[error] 83-83: Extra semicolon.

(@stylistic/semi)


2-7: Great use of dynamic component rendering

The implementation of the dynamic <component> element with proper attribute binding is well done. This approach provides excellent flexibility for rendering different types of elements based on the props.

Also applies to: 21-21


39-54: Well-structured new props with appropriate defaults

The new props (to, href, target, tag) are well-defined with appropriate types and default values. This provides a clear API for component users.

Copy link
Contributor

@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

🧹 Nitpick comments (3)
docs/components/listGroup/examples/FwbListGroupExampleLink.vue (1)

17-17: Remove extra semicolon

According to the project's linting rules, there shouldn't be a semicolon at the end of this import statement.

-import { FwbListGroup, FwbListGroupItem } from '../../../../src/index';
+import { FwbListGroup, FwbListGroupItem } from '../../../../src/index'
🧰 Tools
🪛 ESLint

[error] 17-17: Extra semicolon.

(@stylistic/semi)

src/components/FwbListGroup/FwbListGroupItem.vue (2)

25-85: Fix linting issues with semicolons

There are multiple semicolons at the end of statements throughout the file that should be removed to comply with the project's linting rules.

Consider running a linter to automatically fix these issues, or manually remove the semicolons at the end of lines.

🧰 Tools
🪛 ESLint

[error] 25-25: Member 'toRef' of the import declaration should be sorted alphabetically.

(sort-imports)


[error] 25-25: Extra semicolon.

(@stylistic/semi)


[error] 27-27: Extra semicolon.

(@stylistic/semi)


[error] 29-29: Extra semicolon.

(@stylistic/semi)


[error] 55-55: Extra semicolon.

(@stylistic/semi)


[error] 57-57: Extra semicolon.

(@stylistic/semi)


[error] 58-58: Extra semicolon.

(@stylistic/semi)


[error] 61-61: Extra semicolon.

(@stylistic/semi)


[error] 63-63: Extra semicolon.

(@stylistic/semi)


[error] 64-64: Extra semicolon.

(@stylistic/semi)


[error] 66-66: Extra semicolon.

(@stylistic/semi)


[error] 68-68: Extra semicolon.

(@stylistic/semi)


[error] 70-70: Extra semicolon.

(@stylistic/semi)


[error] 71-71: Extra semicolon.

(@stylistic/semi)


[error] 73-73: Extra semicolon.

(@stylistic/semi)


[error] 76-76: Extra semicolon.

(@stylistic/semi)


[error] 77-77: Extra semicolon.

(@stylistic/semi)


[error] 78-78: Extra semicolon.

(@stylistic/semi)


[error] 79-79: Extra semicolon.

(@stylistic/semi)


[error] 81-81: Extra semicolon.

(@stylistic/semi)


[error] 82-82: Extra semicolon.

(@stylistic/semi)


[error] 83-83: Extra semicolon.

(@stylistic/semi)


[error] 85-85: Extra semicolon.

(@stylistic/semi)


25-25: Fix import member ordering

According to the linting rules, the import members should be alphabetically sorted.

-import { computed, resolveComponent, useAttrs, toRef } from 'vue';
+import { computed, resolveComponent, toRef, useAttrs } from 'vue'
🧰 Tools
🪛 ESLint

[error] 25-25: Member 'toRef' of the import declaration should be sorted alphabetically.

(sort-imports)


[error] 25-25: Extra semicolon.

(@stylistic/semi)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9d6ca45 and e677cea.

📒 Files selected for processing (8)
  • docs/components/button-group.md (1 hunks)
  • docs/components/buttonGroup/examples/FwbButtonGroupExampleDropdown.vue (1 hunks)
  • docs/components/dropdown.md (1 hunks)
  • docs/components/dropdown/examples/FwbDropdownExampleListGroup.vue (2 hunks)
  • docs/components/list-group.md (2 hunks)
  • docs/components/listGroup/examples/FwbListGroupExampleHover.vue (0 hunks)
  • docs/components/listGroup/examples/FwbListGroupExampleLink.vue (1 hunks)
  • src/components/FwbListGroup/FwbListGroupItem.vue (3 hunks)
💤 Files with no reviewable changes (1)
  • docs/components/listGroup/examples/FwbListGroupExampleHover.vue
🚧 Files skipped from review as they are similar to previous changes (5)
  • docs/components/dropdown.md
  • docs/components/buttonGroup/examples/FwbButtonGroupExampleDropdown.vue
  • docs/components/button-group.md
  • docs/components/dropdown/examples/FwbDropdownExampleListGroup.vue
  • docs/components/list-group.md
🧰 Additional context used
🪛 ESLint
docs/components/listGroup/examples/FwbListGroupExampleLink.vue

[error] 17-17: Extra semicolon.

(@stylistic/semi)

src/components/FwbListGroup/FwbListGroupItem.vue

[error] 25-25: Member 'toRef' of the import declaration should be sorted alphabetically.

(sort-imports)


[error] 25-25: Extra semicolon.

(@stylistic/semi)


[error] 27-27: Extra semicolon.

(@stylistic/semi)


[error] 29-29: Extra semicolon.

(@stylistic/semi)


[error] 55-55: Extra semicolon.

(@stylistic/semi)


[error] 57-57: Extra semicolon.

(@stylistic/semi)


[error] 58-58: Extra semicolon.

(@stylistic/semi)


[error] 61-61: Extra semicolon.

(@stylistic/semi)


[error] 63-63: Extra semicolon.

(@stylistic/semi)


[error] 64-64: Extra semicolon.

(@stylistic/semi)


[error] 66-66: Extra semicolon.

(@stylistic/semi)


[error] 68-68: Extra semicolon.

(@stylistic/semi)


[error] 70-70: Extra semicolon.

(@stylistic/semi)


[error] 71-71: Extra semicolon.

(@stylistic/semi)


[error] 73-73: Extra semicolon.

(@stylistic/semi)


[error] 76-76: Extra semicolon.

(@stylistic/semi)


[error] 77-77: Extra semicolon.

(@stylistic/semi)


[error] 78-78: Extra semicolon.

(@stylistic/semi)


[error] 79-79: Extra semicolon.

(@stylistic/semi)


[error] 81-81: Extra semicolon.

(@stylistic/semi)


[error] 82-82: Extra semicolon.

(@stylistic/semi)


[error] 83-83: Extra semicolon.

(@stylistic/semi)


[error] 85-85: Extra semicolon.

(@stylistic/semi)

🔇 Additional comments (5)
docs/components/listGroup/examples/FwbListGroupExampleLink.vue (1)

1-14: Clear and comprehensive examples of the new link functionality!

This example file effectively demonstrates all the key use cases for the enhanced list group item component:

  • Using href for regular links (with active state)
  • Using href with target for external links
  • Using to for router links
  • Regular item without link behavior

This matches perfectly with the PR objectives of adding link support.

src/components/FwbListGroup/FwbListGroupItem.vue (4)

2-7: Great use of dynamic component rendering!

The template now intelligently adapts based on the props provided:

  • Uses dynamic :is binding to render the appropriate element type
  • Dynamically assigns either href or to based on the link type
  • Conditionally applies the target attribute only when needed for external links

This implementation is both flexible and semantically correct.

Also applies to: 21-21


25-55: Well-structured props for enhanced link functionality

The addition of to, href, target, and tag props provides a comprehensive API for link handling:

  • href for standard links
  • to for router links
  • target for controlling how links open
  • tag for custom element rendering

These additions fulfill the PR objective of supporting both external and router-based links.

🧰 Tools
🪛 ESLint

[error] 25-25: Member 'toRef' of the import declaration should be sorted alphabetically.

(sort-imports)


[error] 25-25: Extra semicolon.

(@stylistic/semi)


[error] 27-27: Extra semicolon.

(@stylistic/semi)


[error] 29-29: Extra semicolon.

(@stylistic/semi)


[error] 55-55: Extra semicolon.

(@stylistic/semi)


57-79: Clean implementation of dynamic component and attribute logic

The computed properties provide clear logic for determining:

  1. Whether the item should be a link
  2. What component type to use (li, a, router-link, nuxt-link)
  3. Which attribute to use for the link target (href or to)
  4. When to show the target attribute

This approach makes the component highly flexible while maintaining clear, readable code.

🧰 Tools
🪛 ESLint

[error] 57-57: Extra semicolon.

(@stylistic/semi)


[error] 58-58: Extra semicolon.

(@stylistic/semi)


[error] 61-61: Extra semicolon.

(@stylistic/semi)


[error] 63-63: Extra semicolon.

(@stylistic/semi)


[error] 64-64: Extra semicolon.

(@stylistic/semi)


[error] 66-66: Extra semicolon.

(@stylistic/semi)


[error] 68-68: Extra semicolon.

(@stylistic/semi)


[error] 70-70: Extra semicolon.

(@stylistic/semi)


[error] 71-71: Extra semicolon.

(@stylistic/semi)


[error] 73-73: Extra semicolon.

(@stylistic/semi)


[error] 76-76: Extra semicolon.

(@stylistic/semi)


[error] 77-77: Extra semicolon.

(@stylistic/semi)


[error] 78-78: Extra semicolon.

(@stylistic/semi)


[error] 79-79: Extra semicolon.

(@stylistic/semi)


81-85: Elegant automatic hover detection

This implementation elegantly solves the hover state problem:

  • Automatic detection when a link attribute or click handler is present
  • No need for an explicit hover prop
  • Maintains reactivity by using toRef and computed properly

This delivers on the PR objective of "automatic hover effect detection when a click event handler is present."

🧰 Tools
🪛 ESLint

[error] 81-81: Extra semicolon.

(@stylistic/semi)


[error] 82-82: Extra semicolon.

(@stylistic/semi)


[error] 83-83: Extra semicolon.

(@stylistic/semi)


[error] 85-85: Extra semicolon.

(@stylistic/semi)

@MahmoudGhalayini
Copy link
Author

Anytime! Now it's good to go 👍. Let me know what else you need help with or what would make a difference, and I’ll be happy to assist.

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.

2 participants