Skip to content

Add missing features to BitCard (#12251)#12252

Merged
msynk merged 6 commits intobitfoundation:developfrom
msynk:12251-blazorui-card-missing-featuers
Apr 13, 2026
Merged

Add missing features to BitCard (#12251)#12252
msynk merged 6 commits intobitfoundation:developfrom
msynk:12251-blazorui-card-missing-featuers

Conversation

@msynk
Copy link
Copy Markdown
Member

@msynk msynk commented Apr 11, 2026

closes #12251

Summary by CodeRabbit

  • New Features

    • Enhanced Card component with elevation levels (1–24), custom width and height, no padding option, outlined and square styling variants.
  • Tests

    • Added comprehensive unit tests for Card elevation, padding, outlined, square, and dimension properties.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 11, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4f70679a-a87a-49a2-9407-22a3cf692bce

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The BitCard component gains six new styling and layout parameters—Elevation (int? 1–24), Height, Width, NoPadding, Outlined, and Square—implemented across the component class, SCSS styles, parameter handler, demo page, and corresponding unit tests.

Changes

Cohort / File(s) Summary
Component Implementation
src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Card/BitCard.razor.cs, BitCard.scss
Added six new [Parameter] properties (Elevation, Height, Width, NoPadding, Outlined, Square) with CSS class registration and inline style support. SCSS introduces 24 elevation modifier classes (.bit-crd-e1 through .bit-crd-e24) mapping to shadow variables, plus .bit-crd-npd, .bit-crd-otl, and .bit-crd-sqr classes for padding, outline, and border-radius control.
Parameter Handler
src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Card/BitCardParams.cs
Exposes the same six parameters with conditional application logic in UpdateParameters(), using ClassBuilder.Reset() for class-based properties and StyleBuilder.Reset() for dimension properties.
Demo Updates
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Card/BitCardDemo.razor, BitCardDemo.razor.cs
Restructured and expanded demo examples: replaced static Example 2 with interactive Elevation slider, added new Outlined/Square/NoPadding examples, and width/height control via sliders. Added corresponding C# code snippets and backing fields (elevation, cardWidth, cardHeight).
Test Coverage
src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Surfaces/Card/BitCardTests.cs
Added 8+ unit tests validating CSS class toggling for Elevation (including out-of-range validation), NoPadding, Outlined, and Square; plus style attribute verification for Width and Height properties.

Poem

🐰 Six new tricks for cards so fine,
Elevation shadows, width, and design!
Outlined, squared, and padding-free,
A cardhop's dream—huzzah! ✨

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main objective: adding missing features to BitCard component, which directly corresponds to the changeset modifications.
Linked Issues check ✅ Passed All coding requirements from issue #12251 are met: Elevation, Outlined, Square, NoPadding, Width, and Height properties added to BitCard with supporting CSS classes and tests.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the requested BitCard features; no unrelated modifications were introduced in the pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@msynk msynk marked this pull request as ready for review April 13, 2026 04:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds the missing feature set to BitCard (elevation, outlined, square, no-padding, explicit width/height) and updates the demo/tests accordingly to close #12251.

Changes:

  • Introduces new BitCard parameters (Elevation, Outlined, Square, NoPadding, Width, Height) and wires them into class/style builders.
  • Adds corresponding SCSS classes (elevation levels, outlined/square/no-padding).
  • Expands bUnit tests and updates the demo page to showcase the new options.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Card/BitCard.razor.cs Adds new parameters and registers the new CSS classes/styles.
src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Card/BitCardParams.cs Enables cascading parameter updates for the new BitCard parameters.
src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Card/BitCard.scss Adds elevation/outlined/square/no-padding styling.
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Card/BitCardDemo.razor Adds demo examples for elevation/outlined/square/no-padding/width-height.
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Card/BitCardDemo.razor.cs Updates documented parameters and code snippets for the new demos.
src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Surfaces/Card/BitCardTests.cs Adds tests validating the new parameters’ rendered classes/styles.

Comment thread src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Card/BitCard.scss
Copy link
Copy Markdown

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Card/BitCardDemo.razor.cs (1)

163-176: ⚠️ Potential issue | 🟡 Minor

Keep the displayed snippets aligned with the live demo.

example2RazorCode omits the padded wrapper used in BitCardDemo.razor, and example9RazorCode omits the Style="overflow:hidden" attribute. Since these strings are the copy-paste docs for the demo, they currently won’t reproduce the rendered examples.

Also applies to: 266-281

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Card/BitCardDemo.razor.cs`
around lines 163 - 176, The embedded demo strings example2RazorCode and
example9RazorCode do not match the live BitCardDemo.razor markup; update those
string literals so they include the same padded wrapper around the BitCard used
in BitCardDemo.razor and add the Style="overflow:hidden" attribute to the
BitCard markup in example9RazorCode (and any other snippet(s) noted around the
second range) so the copy-paste snippets reproduce the rendered examples
exactly; locate and modify the readonly fields example2RazorCode,
example2CSharpCode and example9RazorCode in BitCardDemo.razor.cs to mirror the
actual markup/attributes used in the .razor demo.
🧹 Nitpick comments (1)
src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Card/BitCard.razor.cs (1)

115-135: Avoid emitting contradictory modifier classes.

Outlined/NoShadow currently coexist with bit-crd-e*, and Outlined can also coexist with the bit-crd-*-br classes. That only works because BitCard.scss currently declares .bit-crd-nsd/.bit-crd-otl after the elevation and border rules. Encoding the precedence here would make the behavior less fragile.

♻️ Suggested refactor
-        ClassBuilder.Register(() => Border switch
-        {
-            BitColorKind.Primary => "bit-crd-brd bit-crd-pbr",
-            BitColorKind.Secondary => "bit-crd-brd bit-crd-sbr",
-            BitColorKind.Tertiary => "bit-crd-brd bit-crd-tbr",
-            BitColorKind.Transparent => "bit-crd-brd bit-crd-rbr",
-            _ => ""
-        });
+        ClassBuilder.Register(() => Outlined ? string.Empty : Border switch
+        {
+            BitColorKind.Primary => "bit-crd-brd bit-crd-pbr",
+            BitColorKind.Secondary => "bit-crd-brd bit-crd-sbr",
+            BitColorKind.Tertiary => "bit-crd-brd bit-crd-tbr",
+            BitColorKind.Transparent => "bit-crd-brd bit-crd-rbr",
+            _ => ""
+        });

-        ClassBuilder.Register(() => Elevation is >= 1 and <= 24 ? $"bit-crd-e{Elevation}" : string.Empty);
+        ClassBuilder.Register(() =>
+            Elevation is >= 1 and <= 24 && NoShadow is false && Outlined is false
+                ? $"bit-crd-e{Elevation}"
+                : string.Empty);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Card/BitCard.razor.cs` around
lines 115 - 135, The component currently emits potentially conflicting modifier
classes; update the ClassBuilder.Register lambdas so Outlined and NoShadow
suppress contradictory classes: change the Elevation registration (the lambda
using Elevation) to return an empty string when Outlined || NoShadow is true
(otherwise emit $"bit-crd-e{Elevation}" when in range), and change the Border
registration (the lambda using Border) to return an empty string when Outlined
is true (otherwise map Border to the appropriate "bit-crd-brd bit-crd-*-br"
classes); keep other registrations unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Card/BitCardDemo.razor.cs`:
- Around line 163-176: The embedded demo strings example2RazorCode and
example9RazorCode do not match the live BitCardDemo.razor markup; update those
string literals so they include the same padded wrapper around the BitCard used
in BitCardDemo.razor and add the Style="overflow:hidden" attribute to the
BitCard markup in example9RazorCode (and any other snippet(s) noted around the
second range) so the copy-paste snippets reproduce the rendered examples
exactly; locate and modify the readonly fields example2RazorCode,
example2CSharpCode and example9RazorCode in BitCardDemo.razor.cs to mirror the
actual markup/attributes used in the .razor demo.

---

Nitpick comments:
In `@src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Card/BitCard.razor.cs`:
- Around line 115-135: The component currently emits potentially conflicting
modifier classes; update the ClassBuilder.Register lambdas so Outlined and
NoShadow suppress contradictory classes: change the Elevation registration (the
lambda using Elevation) to return an empty string when Outlined || NoShadow is
true (otherwise emit $"bit-crd-e{Elevation}" when in range), and change the
Border registration (the lambda using Border) to return an empty string when
Outlined is true (otherwise map Border to the appropriate "bit-crd-brd
bit-crd-*-br" classes); keep other registrations unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: be4ce7ac-d1c6-4e84-acc6-31b38d558512

📥 Commits

Reviewing files that changed from the base of the PR and between 3142ba2 and 10acace.

📒 Files selected for processing (6)
  • src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Card/BitCard.razor.cs
  • src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Card/BitCard.scss
  • src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Card/BitCardParams.cs
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Card/BitCardDemo.razor
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Card/BitCardDemo.razor.cs
  • src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Surfaces/Card/BitCardTests.cs

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@msynk msynk merged commit 4cc435b into bitfoundation:develop Apr 13, 2026
7 checks passed
@msynk msynk deleted the 12251-blazorui-card-missing-featuers branch April 13, 2026 05:28
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.

Missing features from the BitCard component

2 participants