From 3e4e5d3e26f96a4fac284e6b9d16e7d9e3ac46a6 Mon Sep 17 00:00:00 2001 From: Rory& Date: Sat, 31 May 2025 20:29:51 +0200 Subject: Init test frontend --- .../SafeNSound.Frontend/Pages/Counter.razor | 19 +++++++ testFrontend/SafeNSound.Frontend/Pages/Home.razor | 7 +++ .../SafeNSound.Frontend/Pages/Weather.razor | 60 ++++++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 testFrontend/SafeNSound.Frontend/Pages/Counter.razor create mode 100644 testFrontend/SafeNSound.Frontend/Pages/Home.razor create mode 100644 testFrontend/SafeNSound.Frontend/Pages/Weather.razor (limited to 'testFrontend/SafeNSound.Frontend/Pages') diff --git a/testFrontend/SafeNSound.Frontend/Pages/Counter.razor b/testFrontend/SafeNSound.Frontend/Pages/Counter.razor new file mode 100644 index 0000000..372905f --- /dev/null +++ b/testFrontend/SafeNSound.Frontend/Pages/Counter.razor @@ -0,0 +1,19 @@ +@page "/counter" + +Counter + +

Counter

+ +

Current count: @currentCount

+ + + +@code { + private int currentCount = 0; + + private void IncrementCount() + { + currentCount++; + } + +} \ No newline at end of file diff --git a/testFrontend/SafeNSound.Frontend/Pages/Home.razor b/testFrontend/SafeNSound.Frontend/Pages/Home.razor new file mode 100644 index 0000000..dfcdf75 --- /dev/null +++ b/testFrontend/SafeNSound.Frontend/Pages/Home.razor @@ -0,0 +1,7 @@ +@page "/" + +Home + +

Hello, world!

+ +Welcome to your new app. \ No newline at end of file diff --git a/testFrontend/SafeNSound.Frontend/Pages/Weather.razor b/testFrontend/SafeNSound.Frontend/Pages/Weather.razor new file mode 100644 index 0000000..a0ca515 --- /dev/null +++ b/testFrontend/SafeNSound.Frontend/Pages/Weather.razor @@ -0,0 +1,60 @@ +@page "/weather" +@inject HttpClient Http + +Weather + +

Weather

+ +

This component demonstrates fetching data from the server.

+ +@if (forecasts == null) +{ +

+ Loading... +

+} +else +{ + + + + + + + + + + + @foreach (var forecast in forecasts) + { + + + + + + + } + +
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
+} + +@code { + private WeatherForecast[]? forecasts; + + protected override async Task OnInitializedAsync() + { + forecasts = await Http.GetFromJsonAsync("sample-data/weather.json"); + } + + public class WeatherForecast + { + public DateOnly Date { get; set; } + + public int TemperatureC { get; set; } + + public string? Summary { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + } + +} \ No newline at end of file -- cgit 1.5.1