Basic WEB is working
This commit is contained in:
@@ -13,11 +13,16 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.17" />
|
||||
<PackageReference Include="MudBlazor" Version="8.8.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Bimix.Domain\Bimix.Domain.csproj" />
|
||||
<ProjectReference Include="..\Bimix.Application\Bimix.Application.csproj" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Bimix.Domain\Bimix.Domain.csproj" />
|
||||
<ProjectReference Include="..\Bimix.Application\Bimix.Application.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<div class="my-component">
|
||||
This component is defined in the <strong>Bimix.UI.Shared</strong> library.
|
||||
</div>
|
||||
@@ -1,6 +0,0 @@
|
||||
.my-component {
|
||||
border: 2px dashed red;
|
||||
padding: 1em;
|
||||
margin: 1em 0;
|
||||
background-image: url('background.png');
|
||||
}
|
||||
5
Bimix.UI.Shared/Components/Dashboard.razor
Normal file
5
Bimix.UI.Shared/Components/Dashboard.razor
Normal file
@@ -0,0 +1,5 @@
|
||||
@page "/dashboard"
|
||||
@using MudBlazor
|
||||
|
||||
<MudText Typo="Typo.h4">Dashboard</MudText>
|
||||
<p>Tutaj znajdzie się panel ogólny aplikacji</p>
|
||||
15
Bimix.UI.Shared/Components/Index.razor
Normal file
15
Bimix.UI.Shared/Components/Index.razor
Normal file
@@ -0,0 +1,15 @@
|
||||
@page "/"
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
@code
|
||||
{
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
Navigation.NavigateTo("/dashboard");
|
||||
}
|
||||
|
||||
await base.OnAfterRenderAsync(firstRender);
|
||||
}
|
||||
}
|
||||
10
Bimix.UI.Shared/Components/NavMenu.razor
Normal file
10
Bimix.UI.Shared/Components/NavMenu.razor
Normal file
@@ -0,0 +1,10 @@
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using MudBlazor
|
||||
<MudNavMenu>
|
||||
<MudNavLink href="dashboard" Icon="@Icons.Material.Filled.Dashboard" Match="NavLinkMatch.All">
|
||||
Dashboard
|
||||
</MudNavLink>
|
||||
<MudNavLink Href="products" Icon="@Icons.Material.Filled.List" Match="NavLinkMatch.All">
|
||||
Produkty
|
||||
</MudNavLink>
|
||||
</MudNavMenu>
|
||||
5
Bimix.UI.Shared/Components/ProductList.razor
Normal file
5
Bimix.UI.Shared/Components/ProductList.razor
Normal file
@@ -0,0 +1,5 @@
|
||||
@page "/products"
|
||||
@using MudBlazor
|
||||
|
||||
<MudText Typo="Typo.h4">Produkty</MudText>
|
||||
<p>Lista produktów zostanie tutaj zaimplementowana</p>
|
||||
18
Bimix.UI.Shared/Components/Routes.razor
Normal file
18
Bimix.UI.Shared/Components/Routes.razor
Normal file
@@ -0,0 +1,18 @@
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using MudBlazor
|
||||
|
||||
<Router AppAssembly="@typeof(Routes).Assembly">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
<FocusOnNavigate RouteData="routeData" Selector="h1" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<MudCard Elevation="0">
|
||||
<MudText Typo="Typo.h6">
|
||||
Strona nieznaleziona.
|
||||
</MudText>
|
||||
</MudCard>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
||||
@@ -1,36 +0,0 @@
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace Bimix.UI.Shared;
|
||||
|
||||
// This class provides an example of how JavaScript functionality can be wrapped
|
||||
// in a .NET class for easy consumption. The associated JavaScript module is
|
||||
// loaded on demand when first needed.
|
||||
//
|
||||
// This class can be registered as scoped DI service and then injected into Blazor
|
||||
// components for use.
|
||||
|
||||
public class ExampleJsInterop : IAsyncDisposable
|
||||
{
|
||||
private readonly Lazy<Task<IJSObjectReference>> moduleTask;
|
||||
|
||||
public ExampleJsInterop(IJSRuntime jsRuntime)
|
||||
{
|
||||
moduleTask = new (() => jsRuntime.InvokeAsync<IJSObjectReference>(
|
||||
"import", "./_content/Bimix.UI.Shared/exampleJsInterop.js").AsTask());
|
||||
}
|
||||
|
||||
public async ValueTask<string> Prompt(string message)
|
||||
{
|
||||
var module = await moduleTask.Value;
|
||||
return await module.InvokeAsync<string>("showPrompt", message);
|
||||
}
|
||||
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
if (moduleTask.IsValueCreated)
|
||||
{
|
||||
var module = await moduleTask.Value;
|
||||
await module.DisposeAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
66
Bimix.UI.Shared/MainLayout.razor
Normal file
66
Bimix.UI.Shared/MainLayout.razor
Normal file
@@ -0,0 +1,66 @@
|
||||
@using MudBlazor
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
<MudThemeProvider/>
|
||||
<MudDialogProvider/>
|
||||
<MudSnackbarProvider/>
|
||||
|
||||
<MudLayout>
|
||||
<MudBreakpointProvider OnBreakpointChanged="OnBreakpointChanged"></MudBreakpointProvider>
|
||||
<MudAppBar Elevation="0">
|
||||
<MudIconButton
|
||||
Icon="@Icons.Material.Filled.Menu"
|
||||
Color="Color.Inherit"
|
||||
Edge="Edge.Start"
|
||||
OnClick="ToggleDrawer"
|
||||
Class="mud-hidden-md-up"/>
|
||||
<MudSpacer/>
|
||||
<MudText Typo="Typo.h6">Bimix</MudText>
|
||||
</MudAppBar>
|
||||
|
||||
<MudDrawer @bind-Open="_drawerOpen"
|
||||
Anchor="Anchor.Start"
|
||||
Variant="@_drawerVariant"
|
||||
Elevation="1"
|
||||
ClipMode="DrawerClipMode.Always"
|
||||
Class="mud-width-250">
|
||||
<MudNavMenu>
|
||||
<MudNavLink Href="/dashboard" Icon="@Icons.Material.Filled.Dashboard">Dashboard</MudNavLink>
|
||||
<MudNavLink Href="/products" Icon="@Icons.Material.Filled.Inventory">Products</MudNavLink>
|
||||
</MudNavMenu>
|
||||
</MudDrawer>
|
||||
|
||||
<MudMainContent>
|
||||
<MudContainer MaxWidth="MaxWidth.ExtraLarge" Class="my-4">
|
||||
@Body
|
||||
</MudContainer>
|
||||
</MudMainContent>
|
||||
</MudLayout>
|
||||
|
||||
@code {
|
||||
|
||||
private bool _drawerOpen = true;
|
||||
private DrawerVariant _drawerVariant = DrawerVariant.Persistent;
|
||||
|
||||
void ToggleDrawer()
|
||||
{
|
||||
Console.WriteLine($"ToogleDrawer clickkk {DateTime.Now}");
|
||||
_drawerOpen = !_drawerOpen;
|
||||
}
|
||||
|
||||
private void OnBreakpointChanged(Breakpoint breakpoint)
|
||||
{
|
||||
if (breakpoint < Breakpoint.Md)
|
||||
{
|
||||
_drawerVariant = DrawerVariant.Temporary;
|
||||
_drawerOpen = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_drawerVariant = DrawerVariant.Persistent;
|
||||
_drawerOpen = true;
|
||||
}
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
@@ -1 +1,11 @@
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using System.Net.Http
|
||||
@using System.Net.Http.Json
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using static Microsoft.AspNetCore.Components.Web.RenderMode
|
||||
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||
@using Microsoft.JSInterop
|
||||
@using Bimix.UI.Shared
|
||||
@using Bimix.UI.Shared.Components
|
||||
@using MudBlazor
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 378 B |
@@ -1,6 +0,0 @@
|
||||
// This is a JavaScript module that is loaded on demand. It can export any number of
|
||||
// functions, and may import other JavaScript modules if required.
|
||||
|
||||
export function showPrompt(message) {
|
||||
return prompt(message, 'Type anything here');
|
||||
}
|
||||
Reference in New Issue
Block a user