Skip to content

Commit

Permalink
Add examples and documentation for the Persona component. (#843)
Browse files Browse the repository at this point in the history
* Add examples and documentation for the Persona component.

* Fix the Persona samples to use "@DataSource.SamplePicture" instead of using external resources.

---------

Co-authored-by: Gilles TOURREAU <tourreaug@ardian.com>
  • Loading branch information
GillesTourreau and Gilles TOURREAU committed Oct 14, 2023
1 parent 16620e1 commit a88d671
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<FluentPersona Name="Bill Gates"
Status="PresenceStatus.Available"
StatusSize="PresenceBadgeSize.Small"
StatusTitle="He is available"
Image="@DataSource.SamplePicture"
ImageSize="50px">
</FluentPersona>
20 changes: 20 additions & 0 deletions examples/Demo/Shared/Pages/Persona/Examples/PersonaDismiss.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div hidden="@this.Hidden">
<FluentPersona Name="Bill Gates"
Status="PresenceStatus.Available"
StatusSize="PresenceBadgeSize.Small"
StatusTitle="He is available"
Image="@DataSource.SamplePicture"
ImageSize="50px"
DismissTitle="Hide Bill"
OnDismissClick="@this.Dismiss">
</FluentPersona>
</div>

@code {
private bool Hidden { get; set; }

private void Dismiss()
{
this.Hidden = true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<FluentPersona Name="Lydia Bauer"
ImageSize="50px"
Initials="LY">
</FluentPersona>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<FluentPersona Name="Lydia Bauer"
ImageSize="50px"
Status="PresenceStatus.Busy"
StatusSize="PresenceBadgeSize.Small">
</FluentPersona>
35 changes: 35 additions & 0 deletions examples/Demo/Shared/Pages/Persona/PersonaPage.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@page "/Persona"
@using FluentUI.Demo.Shared.Pages.Persona.Examples

<h1>Persona</h1>
<p>A Persona is a visual representation of a person with an avatar. A status can be specified optionally.</p>

<h2>Examples</h2>
<DemoSection Title="Default" Component="typeof(PersonaDefault)">
<Description>
Display a person with his avatar and his status.
</Description>
</DemoSection>

<DemoSection Title="With no image (Default initials)" Component="typeof(PersonaNoImage)">
<Description>
If no image is specified, the initials of the person is automatically retrieved.
</Description>
</DemoSection>

<DemoSection Title="With no image (Specific initials)" Component="typeof(PersonaInitials)">
<Description>
Explicit initials for the person can be defined with the <code>Initials</code> property.
</Description>
</DemoSection>

<DemoSection Title="Dismiss action" Component="typeof(PersonaDismiss)">
<Description>
Display a "Dismiss" cross and raise an event.
</Description>
</DemoSection>

<h2>API Documentation</h2>
<ApiDocumentation Component="typeof(FluentPersona)" />


1 change: 1 addition & 0 deletions examples/Demo/Shared/Shared/DemoNavMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
<FluentNavLink Href="/Overflow" Icon="@(new Icons.Regular.Size20.MultiselectRtl())">Overflow</FluentNavLink>
<FluentNavLink Href="/Overlay" Icon="@(new Icons.Regular.Size20.CursorHover())">Overlay</FluentNavLink>
<FluentNavLink Href="/Panel" Icon="@(new Icons.Regular.Size20.PanelRight())">Panel</FluentNavLink>
<FluentNavLink Href="/Persona" Icon="@(new Icons.Regular.Size20.PersonAvailable())">Persona</FluentNavLink>
<FluentNavLink Href="/Popover" Icon="@(new Icons.Regular.Size20.TooltipQuote())">Popover</FluentNavLink>
<FluentNavLink Href="/Progress" Icon="@(new Icons.Regular.Size20.SquareHint())">Progress</FluentNavLink>
<FluentNavLink Href="/ProgressRing" Icon="@(new Icons.Regular.Size20.ArrowClockwiseDashes())">Progress Ring</FluentNavLink>
Expand Down
3 changes: 3 additions & 0 deletions examples/Demo/Shared/Shared/DemoNavMenuList.razor
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@
<li>
<FluentAnchor Href="Panel" Appearance=Appearance.Neutral>Panel</FluentAnchor>
</li>
<li>
<FluentAnchor Href="Persona" Appearance=Appearance.Neutral>Persona</FluentAnchor>
</li>
<li>
<FluentAnchor Href="Popover" Appearance=Appearance.Neutral>Popover</FluentAnchor>
</li>
Expand Down
1 change: 1 addition & 0 deletions examples/Demo/Shared/Shared/DemoNavMenuTree.razor
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
<FluentNavMenuLink Href="/Overflow" Icon="@(new Icons.Regular.Size20.MultiselectRtl())" Text="Overflow" />
<FluentNavMenuLink Href="/Overlay" Icon="@(new Icons.Regular.Size20.CursorHover())" Text="Overlay" />
<FluentNavMenuLink Href="/Panel" Icon="@(new Icons.Regular.Size20.PanelRight())" Text="Panel" />
<FluentNavMenuLink Href="/Persona" Icon="@(new Icons.Regular.Size20.PersonAvailable())" Text="Persona" />
<FluentNavMenuLink Href="/Popover" Icon="@(new Icons.Regular.Size20.TooltipQuote())" Text="Popover" />
<FluentNavMenuLink Href="/Progress" Icon="@(new Icons.Regular.Size20.SquareHint())" Text="Progress" />
<FluentNavMenuLink Href="/ProgressRing" Icon="@(new Icons.Regular.Size20.ArrowClockwiseDashes())" Text="Progress Ring" />
Expand Down

0 comments on commit a88d671

Please sign in to comment.