Skip to content

BitShimmer improvements (#9767)#9784

Merged
msynk merged 3 commits intobitfoundation:developfrom
msynk:9767-blazorui-shimmer-improvements
Feb 3, 2025
Merged

BitShimmer improvements (#9767)#9784
msynk merged 3 commits intobitfoundation:developfrom
msynk:9767-blazorui-shimmer-improvements

Conversation

@msynk
Copy link
Member

@msynk msynk commented Feb 2, 2025

closes #9767

Summary by CodeRabbit

  • New Features

    • Expanded shimmer customization with new options for animation timing, pulse effects, circular shapes, and color settings.
  • Style

    • Refined visual appearance by updating animations and introducing cohesive CSS variables for a more modern and consistent look.
  • Documentation

    • Enhanced demo examples with clearer descriptions and streamlined layouts to better showcase the advanced shimmer configurations.

@coderabbitai
Copy link

coderabbitai bot commented Feb 2, 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 revises the BitShimmer component by updating its rendering logic, parameters, and styles. The changes include replacing deprecated parameters and methods with more intuitive ones—introducing new parameters such as AnimationDelay, AnimationDuration, BackgroundColor, Pulse, Circle, and WaveColor—and enhancing CSS with a new variable and refined keyframe names. Additionally, obsolete enums for animation and shape have been removed, and the demo pages updated to reflect the new configuration options.

Changes

File(s) Change Summary
src/BlazorUI/…/BitShimmer.razor
src/BlazorUI/…/BitShimmer.razor.cs
Updated component logic: replaced GetShapesClass() with GetWrapperClass(), integrated GetAnimationStyle(), added parameters (AnimationDelay, AnimationDuration, BackgroundColor, Pulse, Circle, WaveColor), and removed deprecated parameters (Animation, Shape).
src/BlazorUI/…/BitShimmer.scss Introduced new CSS variable --bit-smr-bg-clr, renamed keyframe animations to bit-smr-anim-*, updated background styling, and added multiple state-specific classes.
src/BlazorUI/…/BitShimmerAnimation.cs
src/BlazorUI/…/BitShimmerShape.cs
Removed enums (BitShimmerAnimation and BitShimmerShape) that previously defined animation types and shapes.
src/BlazorUI/…/BitShimmerDemo.razor
src/BlazorUI/…/BitShimmerDemo.razor.cs
Updated demo examples: revised texts, removed redundant wrappers and state code, and adjusted parameters to align with the component changes including new examples for WaveColor and BackgroundColor.
src/BlazorUI/…/BitShimmerDemo.razor.scss Removed unused classes (.shimmer-container, .custom-content), and modified .custom-class box-shadow property.

Assessment against linked issues

Objective Addressed Explanation
Better color gradient [#9767]
Animation speed parameter [#9767]
Color parameter [#9767]

Poem

In a field of code so bright,
I hop with joy both day and night.
Shimmer now dances in refreshed hues,
With speeds and colors that amuse.
My little paws tap with delight—
A rabbit's cheer for changes done right!


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/Progress/Shimmer/BitShimmer.razor.cs (1)

20-25: Clarify parameter names and XML docs.
Both BackgroundColor and WaveColor have the same summary, describing them as “the color of the animated part.” This can lead to confusion. Recommend updating one or both names/documentation to more clearly distinguish the shimmer’s base color versus the wave animation color.

A possible documentation fix:

-/// The color of the animated part of the shimmer.
+/// The background color of the shimmer container.
-/// The color of the animated part of the shimmer.
+/// The wave animation color of the shimmer.

Also applies to: 71-75

src/BlazorUI/Bit.BlazorUI/Components/Progress/Shimmer/BitShimmer.scss (2)

83-137: Introducing State-specific Background Variable Overrides
New state classes such as .bit-smr-pri, .bit-smr-sec, .bit-smr-ter, .bit-smr-inf, .bit-smr-suc, .bit-smr-wrn, .bit-smr-swr, and .bit-smr-err have been added to override the --bit-smr-bg-clr variable using various color variables. Likewise, additional classes (.bit-smr-pbg, .bit-smr-sbg, .bit-smr-tbg, .bit-smr-pfg, .bit-smr-sfg, .bit-smr-tfg) offer more granular control. This systematic approach improves customizability.

Consider leveraging SCSS loops or mixins to generate these similar classes dynamically if more states are likely to be introduced.


152-218: Adding Direct Background Color Classes for States
The new background color classes (e.g., .bit-smr-bpri, .bit-smr-bsec, .bit-smr-bter, .bit-smr-binf, .bit-smr-bsuc, .bit-smr-bwrn, .bit-smr-bswr, .bit-smr-berr, .bit-smr-bpbg, .bit-smr-bsbg, .bit-smr-btbg, .bit-smr-bpfg, .bit-smr-bsfg, .bit-smr-btfg, .bit-smr-bpbr, .bit-smr-bsbr, .bit-smr-btbr) apply direct background-color assignments via specific color variables. This offers explicit styling control for each state.

If the list of states expands further, you might explore abstracting these declarations into a reusable SCSS mixin or function to reduce code duplication.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 886c97e and 25a1789.

📒 Files selected for processing (8)
  • src/BlazorUI/Bit.BlazorUI/Components/Progress/Shimmer/BitShimmer.razor (1 hunks)
  • src/BlazorUI/Bit.BlazorUI/Components/Progress/Shimmer/BitShimmer.razor.cs (4 hunks)
  • src/BlazorUI/Bit.BlazorUI/Components/Progress/Shimmer/BitShimmer.scss (6 hunks)
  • src/BlazorUI/Bit.BlazorUI/Components/Progress/Shimmer/BitShimmerAnimation.cs (0 hunks)
  • src/BlazorUI/Bit.BlazorUI/Components/Progress/Shimmer/BitShimmerShape.cs (0 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Progress/Shimmer/BitShimmerDemo.razor (1 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Progress/Shimmer/BitShimmerDemo.razor.cs (6 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Progress/Shimmer/BitShimmerDemo.razor.scss (1 hunks)
💤 Files with no reviewable changes (2)
  • src/BlazorUI/Bit.BlazorUI/Components/Progress/Shimmer/BitShimmerShape.cs
  • src/BlazorUI/Bit.BlazorUI/Components/Progress/Shimmer/BitShimmerAnimation.cs
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build and test
🔇 Additional comments (44)
src/BlazorUI/Bit.BlazorUI/Components/Progress/Shimmer/BitShimmer.razor.cs (7)

9-12: Looks good for animation delay support.
No functionality concerns.


14-19: Duration parameter addition appears solid.
Implementation is consistent with typical usage for animation durations.


26-29: Pulse parameter looks fine.
Straightforward boolean toggling with no immediate issues identified.


49-50: Height property approach is fine.
No errors or performance concerns.


58-60: Circle parameter naming is intuitive.
Implementation for circular shimmer is clear.


95-120: CSS class registration logic looks correct.
No issues found; fallback to bit-smr-tbg is consistent.


124-161: Wrapper, animation class, and style generation are well-structured.
The usage of separate methods for wrapper class, animation class, and style fosters clarity.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Progress/Shimmer/BitShimmerDemo.razor.cs (18)

9-13: Parameter list update: AnimationDelay.
Consistent with BitShimmer changes.


14-20: Parameter list update: AnimationDuration.
Aligns with new BitShimmer property.


21-29: BackgroundColor parameter in the demo.
Documented usage is consistent with the new parameter in BitShimmer.


30-35: Pulse parameter in the demo.
Looks correct; example usage is straightforward.


76-80: Circle parameter in the component parameters list.
Accurate reflection of the new property.


99-105: WaveColor parameter in the demo.
Mirrors BitShimmer.


108-112: Width parameter enhancements.
Matches the newly extended usage in BitShimmer.


155-268: Color enum additions.
Well-defined comprehensive set of color options.


272-273: New boolean field isDataLoaded.
Correct usage for controlling shimmer.


274-275: New boolean field isContentLoaded.
Same reasoning as isDataLoaded; no issues.


282-283: Example #2 updates.
Demonstrates both linear and circular shimmer usage.


286-291: Example #3 new animation parameters.
Properly illustrates animation delay and duration.


303-328: Example #5 expansions.
Showcases content vs. shimmer template usage with toggling.


332-349: Example #6 wave color usage.
Provides a clear demonstration of the new wave color parameter.


351-368: Example #7 background color usage.
Demonstrates the new background color parameter effectively.


372-372: Custom box-shadow styling.
No problems identified with the example.


390-391: Example #8 usage with inline styles or custom class.
Straightforward illustration of shimmer styling.


393-397: Additional example #8 usage.
Combines custom classes and inline styles for advanced styling.

src/BlazorUI/Bit.BlazorUI/Components/Progress/Shimmer/BitShimmer.razor (1)

22-23: Rendering logic updates for wrapper and animation.
The new calls to @GetWrapperClass() and @GetAnimationClass() plus @GetAnimationStyle() properly implement the added parameters for shape and animation timing. No issues detected.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Progress/Shimmer/BitShimmerDemo.razor (8)

14-16: LGTM! Clear and concise basic example.

The example effectively demonstrates the fundamental usage of BitShimmer with appropriate height parameter.


22-28: LGTM! Clear demonstration of shape options.

The example effectively showcases both default line and circle shapes using the new Circle parameter.


34-43: LGTM! Comprehensive animation examples.

The examples effectively demonstrate:

  • Wave animation with custom duration and delay
  • Pulse animation with both circle and line shapes
  • Good use of BitStack for layout

49-55: LGTM! Well-structured IsDataLoaded example.

Good demonstration of:

  • Conditional content display
  • Accessibility with AriaLabel
  • Interactive toggle functionality

61-87: LGTM! Excellent advanced example.

The example effectively demonstrates:

  • Complex nested structure with Content and ShimmerTemplate
  • Good use of BitStack for layout
  • Integration with other components (BitImage, BitPersona)

93-145: LGTM! Comprehensive WaveColor examples.

Excellent demonstration of all available BitColor options with consistent styling and clear indication of the default color.


150-202: LGTM! Comprehensive BackgroundColor examples.

Excellent demonstration of all available BitColor options with consistent styling and clear indication of the default color.


207-222: LGTM! Well-structured style customization examples.

The example effectively demonstrates:

  • Inline style customization
  • Class-based styling
  • Component-specific styling using Styles and Classes dictionaries
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Progress/Shimmer/BitShimmerDemo.razor.scss (1)

1-18: LGTM! Clean and focused style customizations.

The changes effectively:

  • Update box-shadow with blur radius for better visual effect
  • Remove unused classes (.shimmer-container, .custom-content)
  • Maintain consistent styling for remaining classes
src/BlazorUI/Bit.BlazorUI/Components/Progress/Shimmer/BitShimmer.scss (9)

5-5: CSS Variable Initialization for Background Color
The new CSS variable --bit-smr-bg-clr is initialized with the interpolated value #{$clr-bg-ter}. This centralizes the color definition for easier theming and consistency.


7-15: Renaming & Defining Wave Animation Keyframes
The keyframes for the wave animation have been renamed to bit-smr-anim-wave and defined correctly. This update promotes a consistent naming approach across the component's animations.


17-25: Renaming & Defining Pulse Animation Keyframes
The pulse animation keyframes are now declared as bit-smr-anim-pulse. The transition from opacity 0 to 1 is clear and aligns with the new naming standards.


27-35: Renaming & Defining Opacity Animation Keyframes
The opacity animation keyframes have been updated to bit-smr-anim-opacity, ensuring consistency in naming. The implementation correctly transitions from 0% to 100% opacity.


42-42: Updating Animation Name for Content Container
In the .bit-smr-cnt class, the animation name is now set to bit-smr-anim-opacity, which adheres to the updated naming convention. Verify that the opacity effect meets the desired design.


50-54: Updating Wrapper Animation Settings
Within the .bit-smr-wrp class, adding animation-timing-function: ease and updating the animation-name to bit-smr-anim-opacity ensures smoother animation transitions. This change is consistent with the overall refactoring of animation parameters.


68-70: Utilizing CSS Variable for Animation Background
The .bit-smr-anm class now uses background: var(--bit-smr-bg-clr), replacing any hardcoded color. This enhances maintainability and allows the background to be dynamically controlled via CSS variables.


73-76: Refactoring Wave Animation & Background Gradient
The .bit-smr-wav class has been updated to apply the bit-smr-anim-wave animation with appropriate timing and delay. Its background now uses a linear gradient built on the var(--bit-smr-bg-clr) variable, which boosts consistency in styling.


78-80: Updating Pulse Animation Reference
The .bit-smr-pul class clearly now employs the bit-smr-anim-pulse animation, harmonizing the animation naming throughout the file.

@msynk msynk merged commit 3148811 into bitfoundation:develop Feb 3, 2025
2 checks passed
@msynk msynk deleted the 9767-blazorui-shimmer-improvements branch February 3, 2025 10: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 BitShimmer component needs some improvements

2 participants