Skip to content

Add BitMediaQuery component (#10037)#10044

Merged
msynk merged 2 commits intobitfoundation:developfrom
msynk:10037-blazorui-mediaquery
Feb 25, 2025
Merged

Add BitMediaQuery component (#10037)#10044
msynk merged 2 commits intobitfoundation:developfrom
msynk:10037-blazorui-mediaquery

Conversation

@msynk
Copy link
Member

@msynk msynk commented Feb 25, 2025

closes #10037

Summary by CodeRabbit

  • New Features

    • Introduced a responsive media query component that enables dynamic content display based on screen sizes using predefined breakpoints.
    • Added comprehensive styling support with new CSS classes for various media query thresholds.
    • Launched a dedicated demo page and navigation entry to showcase and interact with the new media query functionality.
  • Chores

    • Updated build configuration to process associated styling files for the demo component.

@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 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

This pull request reformats internal visibility entries in the project file and introduces a responsive media query feature. A new BitMediaQuery component is implemented along with its supporting SCSS styles and an enumeration (BitScreenQuery) to manage screen breakpoints. Additionally, demo pages, navigation updates, and a compiler configuration entry have been added to showcase and compile the media query feature. No changes have been made to exported public APIs.

Changes

File(s) Change Summary
src/BlazorUI/Bit.BlazorUI/Bit.BlazorUI.csproj Reformatted <InternalsVisibleTo> entries by adding a space before the closing /> tag.
src/.../MediaQuery/BitMediaQuery.cs
src/.../MediaQuery/BitScreenQuery.cs
src/.../MediaQuery/BitMediaQuery.scss
Introduced a new BitMediaQuery component for responsive design, added an enum (BitScreenQuery) for screen query definitions, and provided SCSS styling for various media query breakpoints.
src/BlazorUI/Bit.BlazorUI/Styles/components.scss Added an import of the new media query SCSS file.
src/.../MediaQuery/BitMediaQueryDemo.razor
src/.../MediaQuery/BitMediaQueryDemo.razor.cs
Added a new demo page and its code-behind to demonstrate the BitMediaQuery component, showcasing responsive behavior (e.g., for small screens).
src/.../Pages/Home/ComponentsSection.razor
src/.../Shared/MainLayout.razor.NavItems.cs
Updated navigation by adding links directing to the new MediaQuery demo page.
src/.../compilerconfig.json Added a new configuration entry to compile the demo page’s SCSS file into CSS without minification or source maps.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant ML as MainLayout
    participant Demo as MediaQueryDemo Page
    participant BM as BitMediaQuery Component
    U->>ML: Click "MediaQuery" link
    ML->>Demo: Load demo page (/components/mediaquery)
    Demo->>BM: Render BitMediaQuery with BitScreenQuery.Sm
    BM-->>Demo: Build render tree and output "This is SM!"
    Demo-->>U: Display rendered content
Loading

Poem

I'm a rabbit in the code, hopping with delight,
BitMediaQuery sprang to life, shining oh so bright.
SCSS styling and enums all dancing in the breeze,
Demo pages and links set user interfaces at ease.
With every small change, my little heart sings on,
In CodeRabbit's world, our updates hop along! 🐰✨


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: 2

🧹 Nitpick comments (2)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Utilities/MediaQuery/BitMediaQueryDemo.razor (1)

10-12: Consider expanding the demo with more examples.

The basic example demonstrates the component's usage well, but consider adding more examples showcasing different query types (LtMd, GtSm, etc.) to better illustrate the component's capabilities.

src/BlazorUI/Bit.BlazorUI/Components/Utilities/MediaQuery/BitMediaQuery.scss (1)

8-102: Consider using more specific display property instead of unset

Using display: unset will revert to the element's default display value, which might cause inconsistent behavior across different HTML elements.

Consider using a more specific display value like display: block or allowing the display property to be configurable. For example:

.bit-mdq-xs {
    @include xs {
-        display: unset;
+        display: block;
    }
}

Alternatively, you could add an additional class that can be used to specify the display type when the condition is met.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 89c13ea and 1a1b73f.

📒 Files selected for processing (10)
  • src/BlazorUI/Bit.BlazorUI/Bit.BlazorUI.csproj (1 hunks)
  • src/BlazorUI/Bit.BlazorUI/Components/Utilities/MediaQuery/BitMediaQuery.cs (1 hunks)
  • src/BlazorUI/Bit.BlazorUI/Components/Utilities/MediaQuery/BitMediaQuery.scss (1 hunks)
  • src/BlazorUI/Bit.BlazorUI/Components/Utilities/MediaQuery/BitScreenQuery.cs (1 hunks)
  • src/BlazorUI/Bit.BlazorUI/Styles/components.scss (1 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Utilities/MediaQuery/BitMediaQueryDemo.razor (1 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Utilities/MediaQuery/BitMediaQueryDemo.razor.cs (1 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Home/ComponentsSection.razor (1 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cs (1 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • src/BlazorUI/Bit.BlazorUI/Styles/components.scss
  • src/BlazorUI/Bit.BlazorUI/Bit.BlazorUI.csproj
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build and test
🔇 Additional comments (6)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cs (1)

140-140: Navigation item for MediaQuery correctly added.

The navigation item for the new MediaQuery component is properly placed in the Utilities section, following the same pattern as other items.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Home/ComponentsSection.razor (1)

229-231: MediaQuery link added with consistent styling.

The link to the MediaQuery component follows the same structure and styling pattern as other utility components.

src/BlazorUI/Bit.BlazorUI/Components/Utilities/MediaQuery/BitScreenQuery.cs (1)

6-87: Well-structured enum with clear documentation.

The BitScreenQuery enum is well-designed with comprehensive XML documentation for each value. The breakpoints chosen are standard and the naming conventions (Xs, Sm, Md, etc.) align with industry patterns. The inclusion of both specific sizes and comparative queries (LtSm, GtMd, etc.) provides good flexibility.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/compilerconfig.json (1)

434-439: LGTM! New media query demo configuration added correctly.

The configuration entry for the BitMediaQueryDemo component follows the same pattern as other components, with correct path references and consistent formatting.

src/BlazorUI/Bit.BlazorUI/Components/Utilities/MediaQuery/BitMediaQuery.cs (1)

1-63: Good implementation of the media query component

The component is well-structured, following the project's established patterns and conventions. The switch expression for mapping enum values to CSS class names is a clean approach.

src/BlazorUI/Bit.BlazorUI/Components/Utilities/MediaQuery/BitMediaQuery.scss (1)

4-6: Base class hides elements by default

The use of display: none as the default state for the media query component is appropriate, as it ensures elements are hidden until media query conditions are met.

@msynk msynk merged commit b93491f into bitfoundation:develop Feb 25, 2025
3 checks passed
@msynk msynk deleted the 10037-blazorui-mediaquery branch February 25, 2025 21:42
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 BlazorUI project is missing a MediaQuery component

1 participant