Skip to content

Conversation

@Flambe
Copy link
Contributor

@Flambe Flambe commented Apr 17, 2025

The active prop from list groups was missing so this PR adds it as a prop

Summary by CodeRabbit

  • New Features
    • Added support for marking list group items as "active," providing distinct visual styling for active items.
  • Documentation
    • Updated examples and documentation to illustrate the new "active" state for list group items.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 17, 2025

Walkthrough

A new active state was introduced to the list group item component. This involved adding an active Boolean prop to the component, updating the composable logic to apply specific styles for active items, and modifying documentation and example code to demonstrate the new active state. The computed classes now conditionally include active styling, which takes precedence over hover styling when applied. Documentation and example files were updated to reflect and showcase this new functionality.

Changes

File(s) Change Summary
src/components/FwbListGroup/FwbListGroupItem.vue Added active Boolean prop (default false) to the component's props.
src/components/FwbListGroup/composables/useListGroupItemClasses.ts Added active property to props type, introduced activeItemClasses styles, replaced simplifyTailwindClasses with useMergeClasses, and updated logic for class computation to conditionally apply active styles.
docs/components/list-group.md, docs/components/listGroup/examples/FwbListGroupExampleHover.vue Updated example to add active attribute to the first list group item and adjusted formatting for clarity.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant FwbListGroupItem
    participant useListGroupItemClasses

    User->>FwbListGroupItem: Set props (active, hover, disabled)
    FwbListGroupItem->>useListGroupItemClasses: Pass props (active, hover, disabled)
    useListGroupItemClasses-->>FwbListGroupItem: Compute itemClasses (apply active styles if active and not disabled)
    FwbListGroupItem-->>User: Render with computed classes reflecting active state
Loading

Poem

In the garden of lists, a new state appears,
"Active" now shines, dispelling old fears.
With hover and disabled, it joins the parade,
Bringing bold highlights to items displayed.
The docs and examples now gleam with delight—
A hop and a skip, our UI feels right!
🐇✨


📜 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 35e376a and 9fc60ab.

📒 Files selected for processing (1)
  • src/components/FwbListGroup/composables/useListGroupItemClasses.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/FwbListGroup/composables/useListGroupItemClasses.ts

🪧 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.
  • @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.

@netlify
Copy link

netlify bot commented Apr 17, 2025

Deploy Preview for sensational-seahorse-8635f8 ready!

Name Link
🔨 Latest commit 9fc60ab
🔍 Latest deploy log https://app.netlify.com/sites/sensational-seahorse-8635f8/deploys/68013a096c7b7c000882beab
😎 Deploy Preview https://deploy-preview-370--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 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 (1)
docs/components/list-group.md (1)

45-45: Documentation updated correctly to reflect new functionality.

The hover example now includes the active attribute on the first item, which aligns with the component example and demonstrates the new functionality to users.

Consider adding a brief note in the documentation that explains the active state and its priority over hover styling, perhaps in a new section specifically for the active state.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 46f7e6f and 35e376a.

📒 Files selected for processing (4)
  • docs/components/list-group.md (1 hunks)
  • docs/components/listGroup/examples/FwbListGroupExampleHover.vue (1 hunks)
  • src/components/FwbListGroup/FwbListGroupItem.vue (1 hunks)
  • src/components/FwbListGroup/composables/useListGroupItemClasses.ts (2 hunks)
🔇 Additional comments (5)
src/components/FwbListGroup/composables/useListGroupItemClasses.ts (3)

8-8: Good choice of styling for active items.

The Tailwind classes selected for active items (text-white bg-blue-700 dark:bg-gray-800 cursor-pointer) align well with Flowbite's design system. The white text on blue background creates appropriate visual contrast for the active state.


13-13: LGTM! Good addition of active prop to the type definition.

Adding active to the UseListGroupItemClassesProps type correctly extends the component's API.


23-24: Well-implemented styling priority logic.

The implementation correctly prioritizes active styling over hover styling by:

  1. Only applying hover styles when the item is not active and not disabled
  2. Applying active styles when the item is active and not disabled

This ensures a proper visual hierarchy when states are combined.

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

4-7: Good demonstration of the active state.

The first list item now properly showcases the active state alongside hover. The multi-line format also improves code readability.

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

33-36: Prop implementation follows Vue best practices.

The active prop is correctly implemented with:

  • Appropriate Boolean type
  • Default value of false
  • Consistent style with other related props (hover, disabled)

This provides a clean API for component users.

@Sqrcz Sqrcz self-assigned this Apr 17, 2025
@Sqrcz Sqrcz added the 🔧 enhancement New feature or request label Apr 17, 2025
- refactored to use newer `useMergeClasses` composable
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.

Very nice addition. Good catch.

I've updated useListGroupClasses composable to use newer approach with useMergeClasses instead of simplifyTailwindClasses.

@Flambe Please test if it still works as intended... ;)

@Sqrcz Sqrcz merged commit 5d6d260 into themesberg:main Apr 17, 2025
14 checks passed
@Flambe
Copy link
Contributor Author

Flambe commented Apr 17, 2025

@Sqrcz looks good in the netlify deploy! Thanks for the quick response :)

@Flambe Flambe deleted the list-group-item-active branch April 17, 2025 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔧 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants