Skip to content

fix: Background color of the Card component #385 #386

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 2 commits into
base: main
Choose a base branch
from

Conversation

ogzcode
Copy link
Contributor

@ogzcode ogzcode commented May 13, 2025

Added support for an optional class prop in FwbCard component to allow for custom styling. Updated useCardsClasses to conditionally apply background classes based on the provided class prop.

Please check and give feedback. I will be waiting, good day. @Sqrcz @cogor @zoltanszogyenyi

Summary by CodeRabbit

  • New Features
    • Added support for passing custom classes to the card component, allowing greater flexibility in styling.
  • Refactor
    • Improved how background and hover styles are applied, ensuring they do not conflict with custom classes provided by users.

Added support for an optional class prop in FwbCard component to allow for custom styling. Updated useCardsClasses to conditionally apply background classes based on the provided class prop.
Copy link

netlify bot commented May 13, 2025

Deploy Preview for sensational-seahorse-8635f8 ready!

Name Link
🔨 Latest commit 962eb11
🔍 Latest deploy log https://app.netlify.com/sites/sensational-seahorse-8635f8/deploys/6823551cc556b1000820172d
😎 Deploy Preview https://deploy-preview-386--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 13, 2025

Walkthrough

A new class prop was added to the FwbCard Vue component, allowing external classes to be merged with internal classes. The class composition logic in the useCardClasses composable was refactored to conditionally append background and hover classes based on the presence and content of the new class prop.

Changes

Files/Paths Change Summary
src/components/FwbCard/FwbCard.vue Added a class prop; updated root element to merge internal and external classes.
src/components/FwbCard/composables/useCardClasses.ts Extended UseCardsClassesProps to accept a class ref; refactored logic to conditionally append background/hover classes.

Sequence Diagram(s)

sequenceDiagram
    participant ParentComponent
    participant FwbCard
    participant useCardClasses

    ParentComponent->>FwbCard: Passes class prop (optional)
    FwbCard->>useCardClasses: Calls with props (including class)
    useCardClasses-->>FwbCard: Returns computed cardClasses
    FwbCard-->>ParentComponent: Renders with merged classes (internal + external)
Loading

Possibly related PRs

Suggested labels

🪲 bug, 🔧 enhancement

Poem

A card with style, so fresh and new,
Now takes your classes, merges them too!
With backgrounds smart, and hover just right,
Your custom designs take elegant flight.
🐇✨
Cards now dance in your CSS delight!

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 7fc9e3b and 962eb11.

📒 Files selected for processing (1)
  • src/components/FwbCard/composables/useCardClasses.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/FwbCard/composables/useCardClasses.ts
✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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

📜 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 7fc9e3b.

📒 Files selected for processing (2)
  • src/components/FwbCard/FwbCard.vue (2 hunks)
  • src/components/FwbCard/composables/useCardClasses.ts (2 hunks)
🧰 Additional context used
🪛 ESLint
src/components/FwbCard/composables/useCardClasses.ts

[error] 17-17: Trailing spaces not allowed.

(@stylistic/no-trailing-spaces)


[error] 27-27: Extra semicolon.

(@stylistic/semi)

🪛 GitHub Check: lint (18.x)
src/components/FwbCard/composables/useCardClasses.ts

[failure] 27-27:
Extra semicolon


[failure] 17-17:
Trailing spaces not allowed

🪛 GitHub Actions: Node.js CI
src/components/FwbCard/composables/useCardClasses.ts

[error] 17-17: ESLint: Trailing spaces not allowed (@stylistic/no-trailing-spaces)

🔇 Additional comments (6)
src/components/FwbCard/composables/useCardClasses.ts (3)

8-8: Good addition of optional class prop to the interface.

The Ref type is correctly applied, allowing for reactive class strings to be passed from components.


19-24: Clean refactoring of variant class assignment.

The refactoring improves readability by consolidating the variant-based class assignments into a single conditional block with clear variant-specific classes.


30-32: Good conditional hover state handling.

The hover state classes are now correctly applied only when:

  1. A link (href) is present, making the card interactive
  2. No custom class is provided that might include conflicting hover states

This prevents style conflicts when using custom classes.

src/components/FwbCard/FwbCard.vue (3)

4-4: Good implementation of class composition.

Using the array syntax for :class is the correct approach to merge the computed internal classes with the externally provided class prop.


44-47: Well-structured class prop definition.

The new class prop is properly defined with appropriate type and default value. This implementation allows users to pass custom classes to the card component while maintaining the component's base styling.


50-50: Make sure to provide the new class prop to the composable.

The line correctly passes all props to the composable using toRefs(props), which includes the newly added class prop. The composable will now have access to the class property and can apply the conditional background logic.

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