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

[CounterBadge] Add ShowWhen, Dot, and VerticalPosition. #1786

Merged
merged 4 commits into from
Apr 4, 2024

Conversation

vnbaaij
Copy link
Collaborator

@vnbaaij vnbaaij commented Apr 3, 2024

To make the counterbadge more versatile, some rework has been done. Previously when the Count value was 0, the whole component would not get rendered. This made it hard to use the component because you needed a if..else construct to render the component that the FluentCounterBadge wraps. In most cases that lead to repeated rendering logic.

With the changes made, the FluentCounterBadge will always render its container and ChildContent. The rendering of the actual badge is still dependant on the Count'. By default the badge will not be shown if the Count` is zero.

New parameters:

  • ShowWhen: a Func<int,bool> which can be used to specify the condition that determines if the badge is shown. This replaces ShowZero which has now been obsoleted. Default value is Count => Count > 0. To get the ShowZero functionality, you could specify ShowWhen="@(Count => Count >= 0)"

image

  • Dot (bool, default false). When set to true, a dot is rendered instead of a full badge. Count is ignored in this case. BadgeContent

image

  • VerticalPosition (int, default 60) This just replaces the BottomPosition parameter (which has been obsoleted) to better align with the HorizontalPosition parameter name.

  • BadgeContent has been obsoleted and is replaced by BadgeTemplate to be more aligned with how we use this in other parts of the library. BadgeTemplate is now a real template and makes the Count available for use throught the @context parameter.

image

Tests have been veriefied and updated.

- Obsolete BottoPosition, ShowZero
- Update and add examples
- Update Tests
@vnbaaij vnbaaij added the feature A new feature label Apr 3, 2024
@vnbaaij vnbaaij added this to the v4.6.1 milestone Apr 3, 2024
@vnbaaij vnbaaij requested a review from dvoituron April 3, 2024 13:34
Copy link
Collaborator

@dvoituron dvoituron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome new features.

- Undo nullability change on Count
- Prefix CSS styles
- Process oteher review comments
@vnbaaij vnbaaij merged commit 48dae66 into dev Apr 4, 2024
3 checks passed
@vnbaaij vnbaaij deleted the users/vnbaaij/counterbadge-upgrade branch April 4, 2024 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants