-
Notifications
You must be signed in to change notification settings - Fork 459
[dev-v5] Add the PresenceBadge #4461
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
Open
vnbaaij
wants to merge
70
commits into
dev-v5
Choose a base branch
from
users/vnbaaij/dev-v5/add-presence-badge
base: dev-v5
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+754
−22
Open
Changes from all commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
8b14cc0
WIP
vnbaaij 48eafc6
Initial AppBar work
vnbaaij b97d818
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/overflow
vnbaaij 8649abb
Finish work.
vnbaaij b612635
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/overflow
vnbaaij a26f9be
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/overflow
dvoituron c15abee
Merge branch 'users/vnbaaij/dev-v5/overflow' into users/vnbaaij/dev-v…
vnbaaij a67cc88
Make it work
vnbaaij f533730
Add tests (wip)
vnbaaij 02b8049
Add tests (wip)
vnbaaij 4f0de5a
Merge branch 'users/vnbaaij/dev-v5/appbar-part1' of https://github.co…
vnbaaij abebf71
merge dev-v5
vnbaaij 0fd96b6
Make ShowZero=false actually hide the CounterBadge
vnbaaij ef2fe52
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/enhance-counterbadge
vnbaaij d55f890
- Add ShowEmpty parameter
vnbaaij a6e1411
Store
vnbaaij fa695ff
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/appbar-part0
vnbaaij 2b4644d
Fix AppBar
vnbaaij 3132c7e
- Restructure badges docs
vnbaaij 26ae21d
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/enhance-counterbadge
vnbaaij 7f25baa
Cleanup test csproj
vnbaaij a02b4d8
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/appbar-part1
vnbaaij 703b3e5
Fix JSON error
vnbaaij a3e243f
Add check in OverflowRaisedAsync- Use general OverflowItem class
vnbaaij 4e3276a
Merge branch 'users/vnbaaij/dev-v5/enhance-counterbadge' into users/v…
vnbaaij 79ba583
Merge enhance counter badge
vnbaaij c0543ae
Update src/Core/Components/CounterBadge/FluentCounterBadge.razor
vnbaaij 7c9ff33
Update src/Core/Components/CounterBadge/FluentCounterBadge.razor
vnbaaij 8e27d82
Update src/Core/Components/CounterBadge/FluentCounterBadge.razor.cs
vnbaaij 01f6530
Set ShowEmpty="false"
vnbaaij e8b0f75
- Add ContainerStyle to Badge/CounterBadge
vnbaaij 99c7a9a
merge
vnbaaij 7722e39
Merge branch 'users/vnbaaij/dev-v5/enhance-counterbadge' into users/v…
vnbaaij ef80176
Move CounterBadge into badge folder
vnbaaij 7415f88
Merge branch 'users/vnbaaij/dev-v5/enhance-counterbadge' into users/v…
vnbaaij 12593a4
- Add doc icon
vnbaaij ac2a8a6
- Undo .csproj change
vnbaaij be15a14
- Better check in OverflowRaisedAsync
vnbaaij 5b017d1
- Add tests, Alter test to not use Verify
vnbaaij 00d8f1c
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/appbar-part1
vnbaaij 47fb3d9
Process Copilot remarks
vnbaaij ddb7c44
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/enhance-counterbadge
vnbaaij 928446f
Spelling errors
vnbaaij 7933a86
- Add FluentPresenceBadge, examples, icons
vnbaaij 7d1f5ff
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/appbar-part1
vnbaaij 1c24210
Refactor way to set style on badge container
vnbaaij 3e28dbf
merge dev-v5
vnbaaij 9915fba
merge
vnbaaij bae0abc
Fix merge inconsistencies
vnbaaij 6af4847
Fix merging inconsistensies
vnbaaij 3bd39f9
Undo blank line
vnbaaij c8b4e90
Remove ContainerStyle test as parameter is removed
vnbaaij 6a9dd91
Process review comments
vnbaaij bbdcf9a
Process review comments
vnbaaij 9dc1599
merge
vnbaaij 521f923
Try to work around Avatar issue
vnbaaij f5f339d
merge
vnbaaij 0c86f2a
Implement internalized container style for counter badge
vnbaaij dc83c89
Add a StateHasChanged based onGH review comment
vnbaaij 767d510
Merge branch 'users/vnbaaij/dev-v5/cleanup-badges' into users/vnbaaij…
vnbaaij a183390
Add localization, cleunup code
vnbaaij 46d6395
Add tests
vnbaaij d080d71
Add tests, add slot parameter
vnbaaij 7c410de
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/add-presence-badge
vnbaaij f0b0036
More tests, docs
vnbaaij f409297
Undo Avatar slot removal
vnbaaij fa9230a
Fix Avatar tests
vnbaaij ed51dec
Process review comments
vnbaaij 8ad49d8
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/add-presence-badge
vnbaaij 9b8518e
- Process review comment.
vnbaaij File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
....Client/Documentation/Components/Badges/PresenceBadge/Examples/PresenceBadgeDefault.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| <FluentPresenceBadge /> |
34 changes: 34 additions & 0 deletions
34
...Client/Documentation/Components/Badges/PresenceBadge/Examples/PresenceBadgeOnAvatar.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| | ||
| <FluentStack HorizontalGap="12px" Wrap="true"> | ||
| <FluentAvatar Color="AvatarColor.Colorful" Name="Denis Voituron"> | ||
| <FluentPresenceBadge Status="PresenceStatus.Available" slot="@FluentSlot.Badge" /> | ||
| </FluentAvatar> | ||
|
|
||
| <FluentAvatar Color="AvatarColor.Colorful" Name="Vincent Baaij" Shape="AvatarShape.Square"> | ||
| <FluentPresenceBadge Status="PresenceStatus.Away" slot="@FluentSlot.Badge" /> | ||
| </FluentAvatar> | ||
|
|
||
| <FluentAvatar Color="AvatarColor.Colorful" Name="Tyme Bleyaert"> | ||
| <FluentPresenceBadge Status="PresenceStatus.Busy" slot="@FluentSlot.Badge" /> | ||
| </FluentAvatar> | ||
|
|
||
| <FluentAvatar Color="AvatarColor.Colorful" Name="Marvin Klein" Shape="AvatarShape.Square"> | ||
| <FluentPresenceBadge Status="PresenceStatus.DoNotDisturb" slot="@FluentSlot.Badge" /> | ||
| </FluentAvatar> | ||
|
|
||
| <FluentAvatar Color="AvatarColor.Colorful" Name="Adrien Clerbois"> | ||
| <FluentPresenceBadge Status="PresenceStatus.Offline" slot="@FluentSlot.Badge" /> | ||
| </FluentAvatar> | ||
|
|
||
| <FluentAvatar Color="AvatarColor.Colorful" Name="Tof Net" Shape="AvatarShape.Square"> | ||
| <FluentPresenceBadge Status="PresenceStatus.OutOfOffice" slot="@FluentSlot.Badge" /> | ||
| </FluentAvatar> | ||
|
|
||
| <FluentAvatar Color="AvatarColor.Colorful" Name="Scott McPhierson"> | ||
| <FluentPresenceBadge Status="PresenceStatus.Blocked" slot="@FluentSlot.Badge" /> | ||
| </FluentAvatar> | ||
|
|
||
| <FluentAvatar Color="AvatarColor.Colorful" Name="Idris Baker" Shape="AvatarShape.Square"> | ||
| <FluentPresenceBadge Status="PresenceStatus.Unknown" slot="@FluentSlot.Badge" /> | ||
| </FluentAvatar> | ||
| </FluentStack> |
34 changes: 34 additions & 0 deletions
34
...ent/Documentation/Components/Badges/PresenceBadge/Examples/PresenceBadgeOnAvatarOOO.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| | ||
| <FluentStack HorizontalGap="12px" Wrap="true"> | ||
| <FluentAvatar Color="AvatarColor.Colorful" Name="Denis Voituron"> | ||
| <FluentPresenceBadge Status="PresenceStatus.Available" OutOfOffice="true" slot="@FluentSlot.Badge" /> | ||
| </FluentAvatar> | ||
|
|
||
| <FluentAvatar Color="AvatarColor.Colorful" Name="Vincent Baaij" Shape="AvatarShape.Square"> | ||
| <FluentPresenceBadge Status="PresenceStatus.Away" OutOfOffice="true" slot="@FluentSlot.Badge" /> | ||
| </FluentAvatar> | ||
|
|
||
| <FluentAvatar Color="AvatarColor.Colorful" Name="Tyme Bleyaert"> | ||
| <FluentPresenceBadge Status="PresenceStatus.Busy" OutOfOffice="true" slot="@FluentSlot.Badge" /> | ||
| </FluentAvatar> | ||
|
|
||
| <FluentAvatar Color="AvatarColor.Colorful" Name="Marvin Klein" Shape="AvatarShape.Square"> | ||
| <FluentPresenceBadge Status="PresenceStatus.DoNotDisturb" OutOfOffice="true" slot="@FluentSlot.Badge" /> | ||
| </FluentAvatar> | ||
|
|
||
| <FluentAvatar Color="AvatarColor.Colorful" Name="Adrien Clerbois"> | ||
| <FluentPresenceBadge Status="PresenceStatus.Offline" OutOfOffice="true" slot="@FluentSlot.Badge" /> | ||
| </FluentAvatar> | ||
|
|
||
| <FluentAvatar Color="AvatarColor.Colorful" Name="Tof Net" Shape="AvatarShape.Square"> | ||
| <FluentPresenceBadge Status="PresenceStatus.OutOfOffice" OutOfOffice="true" slot="@FluentSlot.Badge" /> | ||
| </FluentAvatar> | ||
|
|
||
| <FluentAvatar Color="AvatarColor.Colorful" Name="Scott McPhierson"> | ||
| <FluentPresenceBadge Status="PresenceStatus.Blocked" OutOfOffice="true" slot="@FluentSlot.Badge" /> | ||
| </FluentAvatar> | ||
|
|
||
| <FluentAvatar Color="AvatarColor.Colorful" Name="Idris Baker" Shape="AvatarShape.Square"> | ||
| <FluentPresenceBadge Status="PresenceStatus.Unknown" OutOfOffice="true" slot="@FluentSlot.Badge" /> | ||
| </FluentAvatar> | ||
| </FluentStack> |
8 changes: 8 additions & 0 deletions
8
...emo.Client/Documentation/Components/Badges/PresenceBadge/Examples/PresenceBadgeSize.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <FluentStack HorizontalGap="5" Wrap="true" VerticalAlignment="VerticalAlignment.Center"> | ||
| <FluentPresenceBadge Status="PresenceStatus.Available" Size="BadgeSize.Tiny" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.Available" Size="BadgeSize.ExtraSmall" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.Available" Size="BadgeSize.Small" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.Available" Size="BadgeSize.Medium" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.Available" Size="BadgeSize.Large" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.Available" Size="BadgeSize.ExtraLarge" /> | ||
| </FluentStack> |
11 changes: 11 additions & 0 deletions
11
...o.Client/Documentation/Components/Badges/PresenceBadge/Examples/PresenceBadgeStatus.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| | ||
| <FluentStack HorizontalGap="5" Wrap="true"> | ||
| <FluentPresenceBadge Status="PresenceStatus.Available" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.Away" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.Busy" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.DoNotDisturb" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.Offline" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.OutOfOffice" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.Blocked" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.Unknown" /> | ||
| </FluentStack> |
11 changes: 11 additions & 0 deletions
11
...lient/Documentation/Components/Badges/PresenceBadge/Examples/PresenceBadgeStatusOOO.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| | ||
| <FluentStack HorizontalGap="5" Wrap="true"> | ||
| <FluentPresenceBadge Status="PresenceStatus.Available" OutOfOffice="true" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.Away" OutOfOffice="true" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.Busy" OutOfOffice="true" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.DoNotDisturb" OutOfOffice="true" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.Offline" OutOfOffice="true" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.OutOfOffice" OutOfOffice="true" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.Blocked" OutOfOffice="true" /> | ||
| <FluentPresenceBadge Status="PresenceStatus.Unknown" OutOfOffice="true" /> | ||
| </FluentStack> |
73 changes: 73 additions & 0 deletions
73
...emo.Client/Documentation/Components/Badges/PresenceBadge/FluentPresenceBadge.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| --- | ||
| title: Presence Badge | ||
| route: /Badges/PresenceBadge | ||
| icon: PresenceAvailable | ||
| --- | ||
|
|
||
|
|
||
| A presence badge is a badge that displays a status indicator such as available, away, or busy. | ||
|
|
||
| ## Change strings used in the UI | ||
|
|
||
| The AppBar uses a string in the UI. It's value can be changed by leveraging the built-in [localization](/localization) functionality. | ||
| The following values can be localized (default value in brackets) : | ||
|
|
||
| - PresenceStatus_Available ("available") | ||
| - PresenceStatus_Away ("away") | ||
| - PresenceStatus_Blocked ("blocked") | ||
| - PresenceStatus_Busy ("busy") | ||
| - PresenceStatus_DoNotDisturb ("do not disturb") | ||
| - PresenceStatus_Offline ("offline") | ||
| - PresenceStatus_OutOfOffice ("out of office") | ||
| - PresenceStatus_Unknown ("unknown") | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Default | ||
|
|
||
| {{ PresenceBadgeDefault }} | ||
|
|
||
| ### Sizes | ||
|
|
||
| A presence badge supports all `BadgeSize` values. The default value is `BadgeSize.Medium`. | ||
|
|
||
| {{ PresenceBadgeSize }} | ||
|
|
||
| ### Status | ||
|
|
||
| A presence badge status is set by mean of the `PresenceStatus` enumeration. See the documentation below for the possible values. The default is `PresenceStatus.Available`. | ||
|
|
||
| {{ PresenceBadgeStatus }} | ||
|
|
||
| ### Out Of Office | ||
|
|
||
| A presence badge can indicate if a user is out of office by setting the `OutOfOffice` parameter to `true`. This will change the appearance of the badge to indicate the out of office status. | ||
|
|
||
| {{ PresenceBadgeStatusOOO }} | ||
|
|
||
| ### On Avatar | ||
|
|
||
| The Avatar component is tailored to work with the PresenceBadge component. The PresenceBadge needs to be supplied as the `ChildContent` of the Avatar component. | ||
|
|
||
| {{ PresenceBadgeOnAvatar }} | ||
|
|
||
| ### On Avatar with OutOfOffice | ||
|
|
||
| The Avatar component is tailored to work with the PresenceBadge component. The PresenceBadge needs to be supplied as the `ChildContent` of the Avatar component. | ||
|
|
||
| {{ PresenceBadgeOnAvatarOOO }} | ||
|
|
||
| ## API FluentPresenceBadge | ||
|
|
||
| The PresenceBadge is a specialized Badge component and does **not** support the following parameters: | ||
|
|
||
| - Appearance | ||
| - BackgroundColor | ||
| - Color | ||
| - Content | ||
| - IconEnd | ||
| - IconLabel | ||
| - IconStart | ||
| - Shape | ||
|
|
||
| {{ API Type=FluentPresenceBadge }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,22 +15,21 @@ | |
| name="@GetNameValue" | ||
| shape="@Shape.ToAttributeValue()" | ||
| size="@Size.ToAttributeValue()" | ||
| slot="@Slot" | ||
| @onclick="@OnClickHandlerAsync" | ||
| @onkeydown="@OnKeyDownHandlerAsync" | ||
| @attributes="@AdditionalAttributes"> | ||
|
|
||
| @if (DisplayImage) | ||
| { | ||
| <img alt="@Name" | ||
| role="presentation" | ||
| aria-hidden="true" | ||
| src="@Image" /> | ||
| } | ||
|
|
||
| @if (DisplayIcon && Icon is not null) | ||
| { | ||
| @Icon.ToMarkup(size: GetAvatarSize, color: "currentcolor", backgroundColor: "unset") | ||
| } | ||
|
||
|
|
||
| @ChildContent | ||
|
|
||
| </fluent-avatar> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| @namespace Microsoft.FluentUI.AspNetCore.Components | ||
| @using Microsoft.FluentUI.AspNetCore.Components.Extensions | ||
| @inherits FluentComponentBase | ||
|
|
||
| <AddTag Name="fluent-badge-container" TagWhen="@(() => _isAttached)"> | ||
| @if (ChildContent is not null) | ||
| { | ||
| @*This is needed to make sure the Avatar renders the initials. It is doing something weird when we just render ChildContent unconditionally *@ | ||
| @ChildContent | ||
| } | ||
| <fluent-badge id="@Id" | ||
| class="@ClassValue" | ||
| style="@StyleValue" | ||
| size="@Size.ToAttributeValue()" | ||
| positioning="@Positioning.ToAttributeValue()" | ||
| aria-label="@_ariaLabel" | ||
| @attributes="@AdditionalAttributes"> | ||
| @if (Icon != null) | ||
| { | ||
| <FluentIcon Width="@($"{_iconWidth}px")" Value="@Icon" Slot="@FluentSlot.Start" Color="Components.Color.Custom" CustomColor="@GetIconColor()" Style="margin: -1px;" /> | ||
| } | ||
| </fluent-badge> | ||
| </AddTag> | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation text states "The AppBar uses a string in the UI" but this is documentation for the PresenceBadge component, not the AppBar. The text should refer to PresenceBadge instead of AppBar.