Addet a backbutton to home page and fix the pr error
This commit is contained in:
@@ -62,12 +62,12 @@ namespace Pos.Service
|
||||
|
||||
if (orderedProductIds.Any(id => id <= 0))
|
||||
throw new ArgumentException(
|
||||
"Rækkefølgen indeholder et ugyldigt id.",
|
||||
"Rækkefølgen indeholder et ugyldigt id.",
|
||||
nameof(orderedProductIds));
|
||||
|
||||
if (orderedProductIds.Distinct().Count() != orderedProductIds.Count)
|
||||
throw new ArgumentException(
|
||||
"Rækkefølgen indeholder dubletter.",
|
||||
"Rækkefølgen indeholder dubletter.",
|
||||
nameof(orderedProductIds));
|
||||
|
||||
_productRepository.SetOrder(
|
||||
|
||||
@@ -1,8 +1,22 @@
|
||||
@rendermode InteractiveServer
|
||||
@rendermode InteractiveServer
|
||||
@implements IDisposable
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<header class="top-nav">
|
||||
<div class="brand">Blomster POS</div>
|
||||
<div class="nav-start">
|
||||
@if (!IsHomePage)
|
||||
{
|
||||
<button class="home-button"
|
||||
type="button"
|
||||
title="Tilbage til forsiden"
|
||||
aria-label="Tilbage til forsiden"
|
||||
@onclick="GoToHome">
|
||||
←
|
||||
</button>
|
||||
}
|
||||
|
||||
<div class="brand">Blomster POS</div>
|
||||
</div>
|
||||
|
||||
<time datetime="@_currentTime.ToString("O")">
|
||||
@_currentTime.ToString(
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
using System.Globalization;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Pos.Web.Components.Shared
|
||||
{
|
||||
public partial class Header
|
||||
{
|
||||
private readonly CultureInfo _danishCulture =
|
||||
CultureInfo.GetCultureInfo("da-DK");
|
||||
CultureInfo.GetCultureInfo("da-DK");
|
||||
|
||||
private readonly Timer _timer;
|
||||
private DateTime _currentTime = DateTime.Now;
|
||||
|
||||
private bool IsHomePage =>
|
||||
string.IsNullOrEmpty(
|
||||
NavigationManager.ToBaseRelativePath(NavigationManager.Uri));
|
||||
|
||||
public Header()
|
||||
{
|
||||
_timer = new Timer(
|
||||
@@ -25,6 +29,11 @@ namespace Pos.Web.Components.Shared
|
||||
_ = InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private void GoToHome()
|
||||
{
|
||||
NavigationManager.NavigateTo("/");
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_timer.Dispose();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* CSS for Header component */
|
||||
.top-nav {
|
||||
min-height: 72px;
|
||||
box-sizing: border-box;
|
||||
@@ -11,14 +10,45 @@
|
||||
border-bottom: 1px solid var(--colorNeutralStroke2);
|
||||
}
|
||||
|
||||
.nav-start {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.brand {
|
||||
color: var(--colorNeutralForeground1);
|
||||
font-size: 26px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.home-button {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
padding: 0;
|
||||
border: 1px solid var(--colorNeutralStroke1);
|
||||
border-radius: 8px;
|
||||
background: transparent;
|
||||
color: var(--colorNeutralForeground1);
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
font-size: 28px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.home-button:hover {
|
||||
background: var(--colorNeutralBackground1Hover);
|
||||
}
|
||||
|
||||
.home-button:focus-visible {
|
||||
outline: 2px solid var(--colorStrokeFocus2);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
time {
|
||||
color: var(--colorNeutralForeground2);
|
||||
font-size: 18px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user