parent
820a19b82b
commit
71e7d74097
@ -1,8 +1,10 @@
|
||||
<Router AppAssembly="@typeof(Program).Assembly">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<p>Sorry, there's nothing at this address.</p>
|
||||
</NotFound>
|
||||
</Router>
|
||||
<CascadingBlazoredModal>
|
||||
<Router AppAssembly="@typeof(Program).Assembly">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<p>Sorry, there's nothing at this address.</p>
|
||||
</NotFound>
|
||||
</Router>
|
||||
</CascadingBlazoredModal>
|
@ -0,0 +1,10 @@
|
||||
<div class="simple-form">
|
||||
|
||||
<p>
|
||||
Are you sure you want to delete @item.DisplayName ?
|
||||
</p>
|
||||
|
||||
<button @onclick="ConfirmDelete" class="btn btn-primary">Delete</button>
|
||||
|
||||
<button @onclick="Cancel" class="btn btn-secondary">Cancel</button>
|
||||
</div>
|
@ -0,0 +1,28 @@
|
||||
@page "/example-tab-set"
|
||||
|
||||
<TabSet>
|
||||
<Tab Title="First tab">
|
||||
<h4>Greetings from the first tab!</h4>
|
||||
|
||||
<label>
|
||||
<input type="checkbox" @bind="showThirdTab" />
|
||||
Toggle third tab
|
||||
</label>
|
||||
</Tab>
|
||||
|
||||
<Tab Title="Second tab">
|
||||
<h4>Hello from the second tab!</h4>
|
||||
</Tab>
|
||||
|
||||
@if (showThirdTab)
|
||||
{
|
||||
<Tab Title="Third tab">
|
||||
<h4>Welcome to the disappearing third tab!</h4>
|
||||
<p>Toggle this tab from the first tab.</p>
|
||||
</Tab>
|
||||
}
|
||||
</TabSet>
|
||||
|
||||
@code {
|
||||
private bool showThirdTab;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
@page "/themed-counter"
|
||||
@using ValblazeProject.UIThemeClasses
|
||||
|
||||
<h1>Themed Counter</h1>
|
||||
|
||||
<p>Current count: @currentCount</p>
|
||||
|
||||
<p>
|
||||
<button class="btn" @onclick="IncrementCount">
|
||||
Increment Counter (Unthemed)
|
||||
</button>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<button class="btn @(ThemeInfo is not null ? ThemeInfo.ButtonClass : string.Empty)"
|
||||
@onclick="IncrementCount">
|
||||
Increment Counter (Themed)
|
||||
</button>
|
||||
</p>
|
||||
|
||||
@code {
|
||||
private int currentCount = 0;
|
||||
|
||||
[CascadingParameter]
|
||||
protected ThemeInfo? ThemeInfo { get; set; }
|
||||
|
||||
private void IncrementCount()
|
||||
{
|
||||
currentCount++;
|
||||
}
|
||||
}
|
@ -1,19 +1,20 @@
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
<PageTitle>ValblazeProject</PageTitle>
|
||||
@using ValblazeProject.UIThemeClasses
|
||||
|
||||
<div class="page">
|
||||
<div class="sidebar">
|
||||
<NavMenu />
|
||||
</div>
|
||||
|
||||
<main>
|
||||
<div class="top-row px-4">
|
||||
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
|
||||
</div>
|
||||
|
||||
<article class="content px-4">
|
||||
@Body
|
||||
</article>
|
||||
</main>
|
||||
<div class="main">
|
||||
<CascadingValue Value="theme">
|
||||
<div class="content px-4">
|
||||
@Body
|
||||
</div>
|
||||
</CascadingValue>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private ThemeInfo theme = new() { ButtonClass = "btn-success" };
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
@using ValblazeProject.UIInterfaces
|
||||
@implements ITab
|
||||
|
||||
<li>
|
||||
<a @onclick="ActivateTab" class="nav-link @TitleCssClass" role="button">
|
||||
@Title
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@code {
|
||||
[CascadingParameter]
|
||||
public TabSet ContainerTabSet { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string Title { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment ChildContent { get; set; }
|
||||
|
||||
private string TitleCssClass =>
|
||||
ContainerTabSet.ActiveTab == this ? "active" : null;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
ContainerTabSet.AddTab(this);
|
||||
}
|
||||
|
||||
private void ActivateTab()
|
||||
{
|
||||
ContainerTabSet.SetActiveTab(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
@using ValblazeProject.UIInterfaces
|
||||
|
||||
<!-- Display the tab headers -->
|
||||
|
||||
<CascadingValue Value=this>
|
||||
<ul class="nav nav-tabs">
|
||||
@ChildContent
|
||||
</ul>
|
||||
</CascadingValue>
|
||||
|
||||
<!-- Display body for only the active tab -->
|
||||
|
||||
<div class="nav-tabs-body p-4">
|
||||
@ActiveTab?.ChildContent
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public RenderFragment ChildContent { get; set; }
|
||||
|
||||
public ITab ActiveTab { get; private set; }
|
||||
|
||||
public void AddTab(ITab tab)
|
||||
{
|
||||
if (ActiveTab == null)
|
||||
{
|
||||
SetActiveTab(tab);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetActiveTab(ITab tab)
|
||||
{
|
||||
if (ActiveTab != tab)
|
||||
{
|
||||
ActiveTab = tab;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 45 KiB |
Loading…
Reference in new issue