Skip to content

Commit

Permalink
[Overlay] Add a timed example
Browse files Browse the repository at this point in the history
  • Loading branch information
vnbaaij committed Jan 8, 2024
1 parent ee9cd15 commit 53e4772
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
43 changes: 43 additions & 0 deletions examples/Demo/Shared/Pages/Overlay/Examples/OverlayTimed.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<FluentSelect Items=@(Enum.GetValues<JustifyContent>())
OptionValue="@(c => c.ToAttributeValue())"
TOption="JustifyContent"
Position="SelectPosition.Below"
@bind-SelectedOption="@justification" />

<FluentSelect Items=@(Enum.GetValues<Align>())
OptionValue="@(c => c.ToAttributeValue())"
TOption="Align"
Position="SelectPosition.Below"
@bind-SelectedOption="@alignment" />
<br />
<br />


<FluentButton Appearance="Appearance.Accent" @onclick="HandleOnOpen">Show Overlay</FluentButton>

<FluentOverlay @bind-Visible=@visible
Opacity="0.4"
Alignment="@alignment"
Justification="@justification"
OnClose="HandleOnClose">
<FluentProgressRing />
</FluentOverlay>

@code {
bool visible = false;
JustifyContent justification = JustifyContent.Center;
Align alignment = Align.Center;

protected void HandleOnClose()
{
DemoLogger.WriteLine("Overlay closed");
}

protected async Task HandleOnOpen()
{
visible = true;
DemoLogger.WriteLine("Overlay opened");
await Task.Delay(3000);
visible = false;
}
}
4 changes: 4 additions & 0 deletions examples/Demo/Shared/Pages/Overlay/OverlayPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
<Description>Overlay with a default white background</Description>
</DemoSection>

<DemoSection Title="Timed" Component="typeof(OverlayTimed)">
<Description>A timed overlay that hides after being shown for 3 seconds</Description>
</DemoSection>

<DemoSection Title="Transparent overlay" Component="typeof(OverlayTransparent)">
<Description>Overlay with a transparent background</Description>
</DemoSection>
Expand Down

0 comments on commit 53e4772

Please sign in to comment.