Skip to content

Commit

Permalink
Inline MainToolbar usage into pages so they can pass params directly
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveSandersonMS committed Oct 29, 2020
1 parent 96819d8 commit fd15831
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 25 deletions.
7 changes: 4 additions & 3 deletions Client/App.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
<Router AppAssembly="@typeof(Program).Assembly" OnNavigateAsync="@OnNavigateAsync">
<Found Context="routeData">
<CascadingValue Value="@routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(Page)" />
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</CascadingValue>
</Found>
<NotFound>
<LayoutView Layout="@typeof(Page)">
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>

@code {
private async Task OnNavigateAsync(NavigationContext args)
{
Expand All @@ -30,4 +31,4 @@
Console.WriteLine(ex);
}
}
}
}
5 changes: 4 additions & 1 deletion Client/Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
@page "/"
@page "/notebook/{Id}"

<Cells @key="@NotebookId" NotebookId="@NotebookId" />
<div class="page">
<MainToolbar />
<Cells @key="@NotebookId" NotebookId="@NotebookId" />
</div>

@code {
[Parameter]
Expand Down
24 changes: 14 additions & 10 deletions Client/Pages/Notebooks.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@
@inject NavigationManager navigation
@inject NotebookService content

<Table TableItem="blazoract.Shared.Notebook" Items="notebooks" RowClickAction="ShowNotebook">
<Column TableItem="blazoract.Shared.Notebook" Title="Id" Field="@(x => x.NotebookId)" Sortable="true"
Filterable="true" Width="25%" />
<Column TableItem="blazoract.Shared.Notebook" Title="Title" Field="@(x => x.Title)" Sortable="true"
Filterable="true" Width="25%" />
<Column TableItem="blazoract.Shared.Notebook" Title="Created At" Field="@(x => x.Created)" Sortable="true"
Width="25%" />
<Column TableItem="blazoract.Shared.Notebook" Title="Updated At" Field="@(x => x.Updated)" Sortable="true"
Width="25%" />
</Table>
<div class="page">
<MainToolbar />

<Table TableItem="blazoract.Shared.Notebook" Items="notebooks" RowClickAction="ShowNotebook">
<Column TableItem="blazoract.Shared.Notebook" Title="Id" Field="@(x => x.NotebookId)" Sortable="true"
Filterable="true" Width="25%" />
<Column TableItem="blazoract.Shared.Notebook" Title="Title" Field="@(x => x.Title)" Sortable="true"
Filterable="true" Width="25%" />
<Column TableItem="blazoract.Shared.Notebook" Title="Created At" Field="@(x => x.Created)" Sortable="true"
Width="25%" />
<Column TableItem="blazoract.Shared.Notebook" Title="Updated At" Field="@(x => x.Updated)" Sortable="true"
Width="25%" />
</Table>
</div>

@code {
private IEnumerable<blazoract.Shared.Notebook> notebooks;
Expand Down
3 changes: 3 additions & 0 deletions Client/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@inherits LayoutComponentBase

@Body
6 changes: 0 additions & 6 deletions Client/Shared/Page.razor

This file was deleted.

5 changes: 0 additions & 5 deletions Client/Shared/Page.razor.css

This file was deleted.

6 changes: 6 additions & 0 deletions Client/wwwroot/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ body {
display: none;
}

.page {
position: relative;
display: flex;
flex-direction: column;
}

body .table-hover tbody tr:hover {
cursor: pointer;
background-color: #fea;
Expand Down

0 comments on commit fd15831

Please sign in to comment.