Selaa lähdekoodia

Navigation improved and appa icons

master
Flo Smilari 4 vuotta sitten
vanhempi
commit
4424116970

+ 1
- 22
Pages/CaritasServicesPage.razor Näytä tiedosto

@@ -1,28 +1,7 @@
@inject NavigationManager NavigationManager;
@page "/caritas_services"
@page "/caritas_services"
<p>Caritas Dienste</p>
@code {
protected override void OnInitialized() {
NavigationManager.LocationChanged += LocationChanged;
base.OnInitialized();
}
public void Dispose() {
NavigationManager.LocationChanged -= LocationChanged;
}
void LocationChanged(object sender, LocationChangedEventArgs e) {
string navigationMethod = e.IsNavigationIntercepted ? "HTML" : "code";
System.Diagnostics.Debug.WriteLine($"Notified of navigation via {navigationMethod} to {e.Location}");
if (e.Location.Contains("caritas_services")) {
}
}
}

+ 16
- 5
Pages/Counter.razor Näytä tiedosto

@@ -1,19 +1,30 @@
@page "/counter"
@inject NavigationManager NavigationManager
<h1>Counter</h1>
<p>Current count: @currentCount</p>
@*<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>*@
<MatButton Raised="true" @onclick="IncrementCount">Click me!</MatButton>
<MatList>
<MatListItem>
<MatButton Raised="true" @onclick="IncrementCount">Click me!</MatButton>
</MatListItem>
<MatListItem>
<MatButton Raised="true" @onclick="ShowCaritasWebpage">Erfahre mehr!</MatButton>
</MatListItem>
</MatList>
@code {
private int currentCount = 0;
private void IncrementCount()
{
private void IncrementCount() {
currentCount++;
}
private void ShowCaritasWebpage() {
NavigationManager.NavigateTo("http://www.caritas.ch");
}
}

+ 2
- 4
Pages/Index.razor Näytä tiedosto

@@ -21,9 +21,7 @@
@code {
void ButtonClicked() {
NavigationManager.NavigateTo("caritas_services");
NavigationManager.NavigateTo("./caritas_services");
AppState.LoggedIn = true;
}
}
@*<SurveyPrompt Title="How is Blazor working for you?" />*@
}

+ 3
- 5
Shared/MainLayout.razor Näytä tiedosto

@@ -1,12 +1,10 @@
@inherits LayoutComponentBase
<NavMenu />
<div class="main vh-100">
<div class="content px-4 h-100">
@Body
</div>
<div class="content px-4 h-100">
@Body
</div>
</div>

+ 27
- 3
Shared/NavMenu.razor Näytä tiedosto

@@ -2,8 +2,7 @@
@inject NavigationManager NavigationManager;
@implements IDisposable;
@if (AppState.LoggedIn) {
@if (handleAppBarContainer()) {
<div class="sidebar">
<MatAppBarContainer>
<MatAppBar Fixed="true">
@@ -60,7 +59,7 @@
{
bool Opened = false;
int Index = 1;
static int Index = 1;
void ButtonClicked() {
Opened = !Opened;
@@ -91,8 +90,33 @@
System.Diagnostics.Debug.WriteLine($"Notified of navigation via {navigationMethod} to {e.Location}");
if (e.Location.Contains("caritas_services")) {
Index = 1;
} else if(e.Location.Contains("counter")) {
Index = 2;
} else if (e.Location.Contains("fetchdata")) {
Index = 3;
} else {
Index = 4;
}
}
bool handleAppBarContainer() {
string uri = NavigationManager.Uri;
string baseUri = NavigationManager.BaseUri;
string delta = uri.Replace(baseUri, "");
if (delta == null || delta.Equals("")) {
Index = 4;
return false;
} else {
if (delta.Equals("caritas_services")) {
Index = 1;
} else if (delta.Equals("counter")) {
Index = 2;
} else if (delta.Equals("fetchdata")) {
Index = 3;
}
return true;
}
}
}

BIN
wwwroot/Icon-120.png Näytä tiedosto


BIN
wwwroot/favicon.ico Näytä tiedosto


BIN
wwwroot/icon-144.png Näytä tiedosto


BIN
wwwroot/icon-192.png Näytä tiedosto


BIN
wwwroot/icon-48.png Näytä tiedosto


BIN
wwwroot/icon-512.png Näytä tiedosto


BIN
wwwroot/icon-72.png Näytä tiedosto


BIN
wwwroot/icon-96.png Näytä tiedosto


+ 30
- 0
wwwroot/manifest.json Näytä tiedosto

@@ -7,6 +7,36 @@
"theme_color": "#db001b",
"orientation": "portrait-primary",
"icons": [
{
"src": "icon-48.png",
"type": "image/png",
"sizes": "48x48"
},
{
"src": "icon-72.png",
"type": "image/png",
"sizes": "72x72"
},
{
"src": "icon-96.png",
"type": "image/png",
"sizes": "96x96"
},
{
"src": "icon-120.png",
"type": "image/png",
"sizes": "120x120"
},
{
"src": "icon-144.png",
"type": "image/png",
"sizes": "144x144"
},
{
"src": "icon-192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "icon-512.png",
"type": "image/png",

Loading…
Peruuta
Tallenna