-
Notifications
You must be signed in to change notification settings - Fork 409
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
feat: add capability in FluentPersona for the name to appear before or after initials. #1750
Conversation
β¦r after initials
β¦ dev
Hi, Thanks for contributing. One thing though...for this functionality I think it is better to use 'Start' and 'End' instead of 'Left' and 'Right' because we also support RTL layouts with these components. |
@if (OnDismissClick.HasDelegate) | ||
{ | ||
<div class="close"> | ||
<FluentIcon Value="@(new CoreIcons.Regular.Size24.Dismiss())" Width="12px" Title="@DismissTitle" OnClick="OnDismissClick" /> | ||
<FluentIcon Value="@(new CoreIcons.Regular.Size24.Dismiss())" Width="12px" Title="@DismissTitle" OnClick="OnDismissClick"/> |
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.
Please, don't remove this space.
/// Gets or sets the position of the image. | ||
/// </summary> | ||
[Parameter] | ||
public PersonaImagePosition? ImagePosition { get; set; } |
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.
I think it would be more logical to follow the "same philosophy" used by React:
by calling the new attribute TextPosition
.
https://react.fluentui.dev/?path=/docs/components-persona--default#text-alignment
/// <summary> | ||
/// The tooltip is positioned to the left of the anchor element. | ||
/// </summary> | ||
Left, |
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.
As in my previous comment, and to follow Vincent's logic, it's probably better to use the names Before
and After
.
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.
We use start/end throughout the library (icon slots, alignment, ...) so I would stick with that. Don't recall we use before/after anywhere
/// Gets or sets the position of the image. | ||
/// </summary> | ||
[Parameter] | ||
public PersonaImagePosition? ImagePosition { get; set; } |
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.
I wouldn't put a nullable property, but with a default value of "Right/After".
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.
End π
</div> | ||
</FluentPresenceBadge> | ||
</div> | ||
@if (!ImagePosition.HasValue || ImagePosition == PersonaImagePosition.Left) |
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.
To avoid duplicating code in this file (depending on the value of ImagePosition
), you could use CSS like this, based on a new position
attribute to be defined on the div
"main".
<div id="@Id" class="@ClassValue" position="@ImagePosition.ToAttributeValue()" ...
.fluent-persona[position='before'] .name {
order: 1;
margin-inline-end: 16px;
}
.fluent-persona[position='before'] .close {
order: 2;
}
.fluent-persona[position='before'] .initials {
order: 3;
}
What do you think? Possible (to be verified if no side effects are detected).
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.
Done. It is cleaner. We might have to revisit this if the goal is feature-parity with fluentui react.
β¦r after initials. Code review feedback completed.
@microsoft-github-policy-service agree |
@@ -62,4 +62,11 @@ | |||
|
|||
</ItemGroup> | |||
|
|||
<ItemGroup> |
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.
Can you remove these new lines. Not required in this csproj.
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.
Sent #1769.
Pull Request
π Description
feat: add capability in FluentPersona for the name to appear before or after initials.
π« Issues
#1735
π©βπ» Reviewer Notes
Unit test was updated to test the change. Demo application FluentPersona section was also updated with example.
π Test Plan
A new unit test was added.
β Checklist
General