Skip to content

Conversation

@msynk
Copy link
Member

@msynk msynk commented Jul 16, 2025

closes #11118

Summary by CodeRabbit

  • New Features

    • Added support for specifying the position of the responsive panel in the drop menu component, allowing placement at the start, end, top, or bottom of the screen.
    • Enhanced demo examples to showcase multiple drop menus with distinct panel positions and improved right-to-left (RTL) layout support.
  • Style

    • Improved styling for responsive drop menus, including dynamic direction handling and modularized position classes for better RTL and layout adaptability.
  • Bug Fixes

    • Refined swipe gesture handling to ensure more accurate boundary detection and prevent interference with native scroll behavior.

@msynk msynk requested review from Cyrus-Sushiant and ysmoradi July 16, 2025 18:06
@coderabbitai
Copy link

coderabbitai bot commented Jul 16, 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

A new nullable PanelPosition parameter was added to the BitDropMenu component, allowing control over the responsive panel's position. Supporting logic was implemented in both the component's C# code and its SCSS styles. Demo examples were updated to showcase the new parameter, and swipe gesture handling logic was refined for better boundary detection.

Changes

File(s) Change Summary
.../Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.razor.cs Added nullable PanelPosition parameter; updated JS interop and CSS class logic to use this parameter.
.../Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.scss Added CSS variable and modifier classes for panel position; improved RTL support and modularized positioning.
.../Bit.BlazorUI/Scripts/Swipes.ts Refined scroll boundary detection and swipe handling logic for better accuracy and RTL support.
.../Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor Updated demo to show multiple menus with explicit PanelPosition and improved content/layout.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BitDropMenu
    participant JSInterop
    participant CSS

    User->>BitDropMenu: Set PanelPosition parameter
    BitDropMenu->>JSInterop: Pass PanelPosition to BitSwipesSetup
    BitDropMenu->>CSS: Apply CSS class based on PanelPosition
    User->>BitDropMenu: Interact with menu (open/close)
    BitDropMenu->>JSInterop: Handle swipe gestures (with improved boundary logic)
Loading

Assessment against linked issues

Objective Addressed Explanation
Add PanelPosition parameter to BitDropMenu for controlling responsive panel position (#11118)

Poem

A hop, a skip, a menu anew—
With panels that slide from top or side view!
Now set your position, with style and precision,
The swipe knows its place, in every condition.
🐇✨
From left or right, or up or down,
The rabbit’s menu wears a crown!

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Knowledge Base: Disabled due to Reviews > Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between ff6b7c3 and 57290ec.

📒 Files selected for processing (4)
  • src/BlazorUI/Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.razor.cs (4 hunks)
  • src/BlazorUI/Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.scss (2 hunks)
  • src/BlazorUI/Bit.BlazorUI/Scripts/Swipes.ts (2 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor (2 hunks)
🔇 Additional comments (8)
src/BlazorUI/Bit.BlazorUI/Scripts/Swipes.ts (1)

125-125: Scroll boundary calculation improvement looks correct.

The use of Math.abs(scrollContainer!.scrollLeft) ensures consistent boundary detection regardless of scroll direction, which is important for RTL layouts where scrollLeft can be negative.

src/BlazorUI/Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.razor.cs (3)

59-62: Well-structured parameter addition.

The nullable BitPanelPosition? parameter with clear documentation follows proper component design patterns. The nullable type allows for optional specification while maintaining backward compatibility.


169-169: Appropriate default value handling.

The null-coalescing operator PanelPosition ?? BitPanelPosition.End provides a sensible default while allowing customization. This maintains backward compatibility for existing usage.


250-257: CSS class generation logic is correct.

The switch expression properly maps all BitPanelPosition values to their corresponding CSS classes, with a sensible default fallback to "bit-drm-end". The implementation is clean and maintainable.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor (2)

57-79: Excellent demonstration of the new PanelPosition parameter.

The demo effectively showcases both BitPanelPosition.End and BitPanelPosition.Start with distinct ScrollContainerId values. The use of BitStack with FitWidth and BitText with NoWrap provides clear visual examples of the responsive behavior.


159-177: Comprehensive RTL demonstration.

The RTL section properly demonstrates the new positioning functionality in right-to-left context. The use of different ScrollContainerId values (sc-con-rtl1, sc-con-rtl2) and explicit PanelPosition settings showcases the feature's RTL compatibility.

src/BlazorUI/Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.scss (2)

11-15: Elegant RTL support implementation.

The CSS custom property --bit-drm-transform-factor with RTL-specific override is a clean solution for handling directional transforms. This approach avoids code duplication and provides consistent behavior across different panel positions.


100-126: Comprehensive position modifier classes.

The position modifier classes provide complete coverage for all panel positions:

  • .bit-drm-sta and .bit-drm-end use the transform factor for RTL-aware horizontal positioning
  • .bit-drm-top and .bit-drm-btm provide vertical positioning with appropriate transforms
  • Proper use of logical properties (inset-block, inset-inline-start, inset-inline-end) enhances internationalization support

@msynk msynk merged commit 7cf6760 into bitfoundation:develop Jul 17, 2025
3 checks passed
@msynk msynk deleted the 11118-blazorui-dropmenu-panelposition branch July 17, 2025 09:53
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 BitDropMenu component is missing a PanelPosition parameter

1 participant