Skip to content

Add new Icon parameters to BitSwiper (#12225)#12226

Merged
msynk merged 1 commit into
bitfoundation:developfrom
msynk:12225-blazorui-swiper-new-icons
Mar 30, 2026
Merged

Add new Icon parameters to BitSwiper (#12225)#12226
msynk merged 1 commit into
bitfoundation:developfrom
msynk:12225-blazorui-swiper-new-icons

Conversation

@msynk
Copy link
Copy Markdown
Member

@msynk msynk commented Mar 29, 2026

closes #12225

Summary by CodeRabbit

Release Notes

  • New Features

    • Swiper component navigation icons are now customizable, supporting both custom icon libraries and built-in icon options with configurable precedence.
  • Documentation

    • Added demo examples showing integration with external icon libraries such as FontAwesome and Bootstrap Icons.
  • Tests

    • Added comprehensive test coverage for navigation icon customization and precedence behavior.

@msynk msynk changed the title Add new Icon parameters to BitSwiper (#12219) Add new Icon parameters to BitSwiper (#12225) Mar 29, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 29, 2026

Walkthrough

The BitSwiper component now supports customizable navigation icons through new parameters. Users can configure icons using either built-in Fluent UI icon names (NextIconName/PrevIconName) or external icon libraries via BitIconInfo objects (NextIcon/PrevIcon). Related CSS styling was adjusted and comprehensive test coverage was added.

Changes

Cohort / File(s) Summary
Icon Parameter Configuration
src/BlazorUI/Bit.BlazorUI/Components/Lists/Swiper/BitSwiper.razor.cs
Added four new [Parameter] properties: NextIcon, PrevIcon (type BitIconInfo?), and NextIconName, PrevIconName (type string?) for configuring navigation button icons with documented precedence rules.
Template Updates
src/BlazorUI/Bit.BlazorUI/Components/Lists/Swiper/BitSwiper.razor
Modified navigation button rendering to use dynamically computed icon classes from parameters instead of hardcoded CSS classes, with fallback to default ChevronRight icon.
Styling Adjustments
src/BlazorUI/Bit.BlazorUI/Components/Lists/Swiper/BitSwiper.scss
Removed .bit-swp-lbi CSS rule (which applied transform: scaleX(-1)) and removed BOM character from import statement.
Demo & Documentation
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Lists/Swiper/BitSwiperDemo.razor*
Added new demo example showcasing external icon integration (FontAwesome and Bootstrap Icons) and exposed new icon parameters in the component documentation with subclass definitions.
Test Coverage
src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Lists/Swiper/BitSwiperTests.cs
Added six new test methods verifying default icons, icon name parameters, full icon objects via BitIconInfo, and parameter precedence rules (object overrides name when both set).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 ✨ Swiper icons now dance with grace,
Built-in or external—choose your place!
FontAwesome, Bootstrap, Fluent too,
Parameters guide what chevrons do.
Precedence rules keep order neat,
Navigation customization—complete! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR addresses BitSwiper icon parameters but the linked issue #12219 is about missing Icon implementation in BitTextField's ClearButtonIcon, not BitSwiper navigation icons. Verify that the correct linked issue is referenced or update the PR to address the actual BitTextField Icon implementation requirements from issue #12219.
Out of Scope Changes check ⚠️ Warning The entire PR scope (BitSwiper icon parameters) appears out of scope relative to the linked issue #12219, which specifically requests Icon implementation for BitTextField's ClearButtonIcon. Confirm the linked issue is correct, or redirect this PR to address BitTextField instead of BitSwiper for the reported requirements.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add new Icon parameters to BitSwiper (#12225)' directly and clearly describes the main change: adding new Icon parameters to the BitSwiper component.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Lists/Swiper/BitSwiperDemo.razor (1)

90-90: Add SRI integrity hashes to external CDN stylesheets, or self-host these assets.

Lines 90 and 110 load Font Awesome and Bootstrap Icons from external CDNs without integrity and crossorigin attributes. This is a security risk if the CDN is compromised.

Options:

  1. Compute and add SHA-384 integrity hashes using: curl -s <URL> | openssl dgst -sha384 -binary | openssl base64 -A then prefix with sha384-
  2. Self-host these CSS files locally

Also apply the same update to the code samples in src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Lists/Swiper/BitSwiperDemo.razor.cs (lines 249 and 264).

🤖 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/Lists/Swiper/BitSwiperDemo.razor`
at line 90, The external CDN CSS links in BitSwiperDemo.razor (Font Awesome and
Bootstrap Icons) and the corresponding code samples in BitSwiperDemo.razor.cs
must include Subresource Integrity and crossorigin attributes or be replaced
with locally hosted files; compute each SHA-384 hash with the provided command
(curl ... | openssl dgst -sha384 -binary | openssl base64 -A) and add
integrity="sha384-<hash>" and crossorigin="anonymous" to the <link> tags, or
update the hrefs to point to local copies and remove CDN usage—make the same
change in the string literals or markup snippets in BitSwiperDemo.razor.cs so
the demo code matches the actual markup.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/BlazorUI/Bit.BlazorUI/Components/Lists/Swiper/BitSwiper.razor`:
- Around line 20-21: The fallback logic for icon names in BitSwiper.razor
currently uses the null-coalescing operator (NextIconName ?? "ChevronRight" and
PrevIconName ?? "ChevronRight bit-ico-r180") which doesn't handle empty or
whitespace strings; update the code that builds nextIcon and prevIcon (where
BitIconInfo.From is called) to use a check like
string.IsNullOrWhiteSpace(NextIconName) /
string.IsNullOrWhiteSpace(PrevIconName) and supply the default names only when
the provided name is null/empty/whitespace so empty strings don't bypass the
fallback.

---

Nitpick comments:
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Lists/Swiper/BitSwiperDemo.razor`:
- Line 90: The external CDN CSS links in BitSwiperDemo.razor (Font Awesome and
Bootstrap Icons) and the corresponding code samples in BitSwiperDemo.razor.cs
must include Subresource Integrity and crossorigin attributes or be replaced
with locally hosted files; compute each SHA-384 hash with the provided command
(curl ... | openssl dgst -sha384 -binary | openssl base64 -A) and add
integrity="sha384-<hash>" and crossorigin="anonymous" to the <link> tags, or
update the hrefs to point to local copies and remove CDN usage—make the same
change in the string literals or markup snippets in BitSwiperDemo.razor.cs so
the demo code matches the actual markup.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 917e2deb-f265-4e28-8d29-e0764a32ac88

📥 Commits

Reviewing files that changed from the base of the PR and between ff7da72 and 4fd8642.

📒 Files selected for processing (6)
  • src/BlazorUI/Bit.BlazorUI/Components/Lists/Swiper/BitSwiper.razor
  • src/BlazorUI/Bit.BlazorUI/Components/Lists/Swiper/BitSwiper.razor.cs
  • src/BlazorUI/Bit.BlazorUI/Components/Lists/Swiper/BitSwiper.scss
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Lists/Swiper/BitSwiperDemo.razor
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Lists/Swiper/BitSwiperDemo.razor.cs
  • src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Lists/Swiper/BitSwiperTests.cs

Comment thread src/BlazorUI/Bit.BlazorUI/Components/Lists/Swiper/BitSwiper.razor
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 customizable navigation icons to BitSwiper to support external icon libraries (via BitIconInfo) alongside built-in Fluent UI icon names, and updates the demo/tests accordingly.

Changes:

  • Added NextIcon/PrevIcon (BitIconInfo?) and NextIconName/PrevIconName (string?) parameters to BitSwiper with defined precedence.
  • Updated BitSwiper rendering to resolve icons via BitIconInfo.From(...) and removed the old CSS-based mirroring approach.
  • Extended the demo page and added test coverage for icon customization and precedence.

Reviewed changes

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

Show a summary per file
File Description
src/BlazorUI/Bit.BlazorUI/Components/Lists/Swiper/BitSwiper.razor.cs Introduces new icon parameters for next/prev navigation.
src/BlazorUI/Bit.BlazorUI/Components/Lists/Swiper/BitSwiper.razor Uses BitIconInfo.From to render resolved icon classes for nav buttons.
src/BlazorUI/Bit.BlazorUI/Components/Lists/Swiper/BitSwiper.scss Removes the old bit-swp-lbi mirroring rule (rotation now handled via classes).
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Lists/Swiper/BitSwiperDemo.razor.cs Documents new parameters, adds BitIconInfo subclass docs, and adds an external-icons sample snippet.
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Lists/Swiper/BitSwiperDemo.razor Adds an “External Icons” demo section and wires subclasses into DemoPage.
src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Lists/Swiper/BitSwiperTests.cs Adds tests for default icon behavior, custom icon rendering, and precedence rules.

Comment thread src/BlazorUI/Bit.BlazorUI/Components/Lists/Swiper/BitSwiper.razor
@msynk msynk merged commit a7e5ed3 into bitfoundation:develop Mar 30, 2026
7 checks passed
@msynk msynk deleted the 12225-blazorui-swiper-new-icons branch March 30, 2026 05:02
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.

New Icon implementation for the BitSwiper component

3 participants