Add new Icon parameter to BitDropdown (#12086)#12087
Add new Icon parameter to BitDropdown (#12086)#12087msynk merged 2 commits intobitfoundation:developfrom
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThis PR adds external icon support to the BitDropdown component, enabling custom icons via a new Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Fix all issues with AI agents
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.cs`:
- Around line 97-109: GetExternalIconBiItems contains invalid Bootstrap Icon
names for the items with Value "f-gra" and "v-car" (currently
BitIconInfo.Bi("grape") and BitIconInfo.Bi("carrot")). Replace those two Bi(...)
calls with valid Bootstrap icon names from the Bootstrap Icons catalog (e.g.,
pick appropriate alternatives) by updating the Icon property for the
BitDropdownItem entries inside GetExternalIconBiItems so they use valid
BitIconInfo.Bi("valid-name") values.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.samples.cs`:
- Around line 795-878: The demo uses the Pro-only Font Awesome "fa-grapes" which
won't render with the free CDN and references an older Bootstrap Icons CDN;
update occurrences of the Pro icon in GetExternalIconFaItems and the razor
sample (example15CsharpCode / example15RazorCode) to a free Font Awesome icon
(e.g., replace "fa-solid fa-grapes" with a free alternative like "fa-solid
fa-seedling" or another free icon) and update the bootstrap-icons CDN version in
example15RazorCode from "@1.11.3" to the current stable release (e.g.,
"@1.13.1"); apply the same replacement in the runtime file
_BitDropdownItemDemo.razor.cs where GetExternalIconFaItems is defined.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor`:
- Line 717: The BitDropdownOption line uses an invalid FontAwesome icon via
BitIconInfo.Fa("solid orange"); update the BitDropdownOption that contains
BitIconInfo.Fa("solid orange") to use a valid icon (for example replace with
BitIconInfo.Css("fa-solid fa-circle") or BitIconInfo.Fa("solid sun")) so the
rendered class is a real FontAwesome icon; locate the BitDropdownOption instance
in _BitDropdownOptionDemo.razor and swap the BitIconInfo.Fa(...) call
accordingly.
- Line 733: The BitDropdownOption instance using Icon="@BitIconInfo.Bi("grape")"
is referencing a non-existent Bootstrap Icons name; update the Icon argument on
the BitDropdownOption (in _BitDropdownOptionDemo.razor) to use a valid Bootstrap
Icons name (for example "circle-fill" or another name from the official
Bootstrap Icons set) by replacing "grape" with the chosen valid icon string so
Icon="@BitIconInfo.Bi(\"circle-fill\")" (or your selected valid name).
🧹 Nitpick comments (4)
src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.scss (1)
1-2: Pre-existing Stylelint violation:.scssextension in@import.Stylelint (
scss/load-partial-extension) flags the.scssextension on both import lines. Since this is a pre-existing pattern (line 2 is unchanged and uses the same convention), it's not introduced by this PR — but worth noting for a future cleanup pass. Modern Sass recommends@use/@forwardover@import, and omitting the extension for partials.src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razor (1)
18-19: Consider removing commented-out code or adding context.The
IntroductionVideoUrlis commented out without explanation. If this is intentional and temporary, a brief note on why would help future maintainers.src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor (1)
683-684: External stylesheets loaded inline within the component body.These
<link>tags are rendered inside the component body rather than in<head>. Every time this demo component renders, these elements get injected into the DOM body. Consider moving them toindex.html/_Host.cshtml/App.razor<head>section, or use Blazor's<HeadContent>to place them properly.src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/BitDropdownDemo.razor.cs (1)
447-461: Inconsistent ordering ofIcon/IconNamebetweenBitDropdownItemandBitDropdownOptionparameter lists.In
BitDropdownItem(line 447),IconandIconNameare placed right afterId, beforeData. InBitDropdownOption(line 585), they're placed afterIsSelected, beforeItemType. Consider aligning the field order for consistency across the two types, as developers will reference both.Also applies to: 585-599
...Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.cs
Show resolved
Hide resolved
...orUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownItemDemo.razor.samples.cs
Show resolved
Hide resolved
.../Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor
Outdated
Show resolved
Hide resolved
.../Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/Dropdown/_BitDropdownOptionDemo.razor
Outdated
Show resolved
Hide resolved
|


closes #12086
Summary by CodeRabbit