Skip to content
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

BitSearchBox component improvements (#9630) #9634

Merged

Conversation

msynk
Copy link
Member

@msynk msynk commented Jan 7, 2025

closes #9630

Summary by CodeRabbit

  • New Features

    • Added accent color options for search box
    • Introduced ability to remove search box border
    • Enhanced search box styling customization
  • Documentation

    • Updated demo examples to showcase new search box configuration options
  • Style

    • Added new CSS classes for accent colors and borderless design
    • Refined search box visual styling

Copy link

coderabbitai bot commented Jan 7, 2025

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.

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

Walkthrough

The pull request introduces enhancements to the BitSearchBox component in the Blazor UI library. Two new properties, NoBorder and Accent, have been added to provide more styling flexibility. The NoBorder property allows removing the default border, while the Accent property enables specifying an accent color. Corresponding SCSS styles have been updated to support these new customization options. The demo page has been modified to showcase these new features, including example implementations and updated code references.

Changes

File Change Summary
src/BlazorUI/.../BitSearchBox.razor.cs Added Accent (BitColorKind?) and NoBorder (bool) properties with [Parameter] attribute
src/BlazorUI/.../BitSearchBox.scss Added new CSS classes for accent colors and no-border styling
src/BlazorUI/.../BitSearchBoxDemo.razor Updated example boxes, added "Accent" and renamed "Icon" to "NoBorder"
src/BlazorUI/.../BitSearchBoxDemo.razor.cs Added Accent and NoBorder parameters, introduced BitColorKind enum

Assessment against linked issues

Objective Addressed Explanation
New NoBorder parameter [#9630]
New Accent parameter [#9630]

Poem

🐰 A search box with flair so bright,
Borders vanish, colors take flight!
Accent and style, now set with glee,
Customization's the key, you'll see!
Hop along, UI design delight! 🎨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • 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. (Beta)
  • @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

@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 (3)
src/BlazorUI/Bit.BlazorUI/Components/Inputs/SearchBox/BitSearchBox.razor.cs (1)

194-203: Consider using a dictionary for accent class mapping.

The switch expression works but could be refactored to use a dictionary for better maintainability and performance.

+    private static readonly Dictionary<BitColorKind, string> AccentClasses = new()
+    {
+        { BitColorKind.Primary, "bit-srb-apri" },
+        { BitColorKind.Secondary, "bit-srb-asec" },
+        { BitColorKind.Tertiary, "bit-srb-ater" },
+        { BitColorKind.Transparent, "bit-srb-atra" }
+    };

-        ClassBuilder.Register(() => Accent switch
-        {
-            BitColorKind.Primary => "bit-srb-apri",
-            BitColorKind.Secondary => "bit-srb-asec",
-            BitColorKind.Tertiary => "bit-srb-ater",
-            BitColorKind.Transparent => "bit-srb-atra",
-            _ => string.Empty
-        });
+        ClassBuilder.Register(() => Accent.HasValue ? AccentClasses.GetValueOrDefault(Accent.Value, string.Empty) : string.Empty);
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/SearchBox/BitSearchBoxDemo.razor (1)

51-65: Consider adding visual indicators for transparent accent.

The transparent accent example might be hard to distinguish. Consider adding a background color to the container or a note about its usage.

src/BlazorUI/Bit.BlazorUI/Components/Inputs/SearchBox/BitSearchBox.scss (1)

136-158: Consider using CSS variables for background colors.

The accent background colors could be defined as CSS variables for easier theming and maintenance.

+:root {
+    --bit-srb-bg-pri: #{$clr-bg-pri};
+    --bit-srb-bg-sec: #{$clr-bg-sec};
+    --bit-srb-bg-ter: #{$clr-bg-ter};
+}

 .bit-srb-apri {
     .bit-srb-cnt {
-        background-color: $clr-bg-pri;
+        background-color: var(--bit-srb-bg-pri);
     }
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0d7b7c4 and 9a3e75b.

📒 Files selected for processing (4)
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/SearchBox/BitSearchBox.razor.cs (3 hunks)
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/SearchBox/BitSearchBox.scss (3 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/SearchBox/BitSearchBoxDemo.razor (7 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/SearchBox/BitSearchBoxDemo.razor.cs (9 hunks)
🔇 Additional comments (7)
src/BlazorUI/Bit.BlazorUI/Components/Inputs/SearchBox/BitSearchBox.razor.cs (1)

25-28: LGTM! Well-documented properties.

The new properties Accent and NoBorder are properly documented with XML comments and marked with the [Parameter] attribute.

Also applies to: 85-89

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/SearchBox/BitSearchBoxDemo.razor (2)

39-49: LGTM! Clear demonstration of the NoBorder feature.

The example effectively shows both enabled and disabled states of the NoBorder style.


94-100: LGTM! Comprehensive demonstration of combined features.

Good coverage of NoBorder with ShowSearchButton in both enabled and disabled states.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/SearchBox/BitSearchBoxDemo.razor.cs (2)

269-301: LGTM! Well-structured enum definition.

The BitColorKind enum is properly documented with clear descriptions for each value.


456-464: LGTM! Clear example code.

The example code strings accurately reflect the component usage.

src/BlazorUI/Bit.BlazorUI/Components/Inputs/SearchBox/BitSearchBox.scss (2)

109-120: LGTM! Proper base styling.

The base styles provide a solid foundation for the component's appearance.


376-412: LGTM! Comprehensive no-border styling.

The NoBorder styles properly handle all states including focus, hover, and search button variations.

@msynk msynk merged commit 801393a into bitfoundation:develop Jan 8, 2025
3 checks passed
@msynk msynk deleted the 9630-blazorui-searchbox-improvements branch January 8, 2025 08:06
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.

The BitSearchBox component needs some improvements
3 participants