Update style
This commit is contained in:
@@ -2,12 +2,7 @@
|
|||||||
@inherits LayoutComponentBase
|
@inherits LayoutComponentBase
|
||||||
|
|
||||||
<div class="page">
|
<div class="page">
|
||||||
@if (IsLoading) {
|
|
||||||
<Loader />
|
|
||||||
}
|
|
||||||
|
|
||||||
@Body
|
@Body
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span class="orb red"></span>
|
<span class="orb red"></span>
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
|
|
||||||
using System.Net.Http.Json;
|
|
||||||
using GameIdeas.Resources;
|
|
||||||
|
|
||||||
namespace GameIdeas.BlazorApp.Layouts
|
|
||||||
{
|
|
||||||
public partial class MainLayout
|
|
||||||
{
|
|
||||||
public bool IsLoading { get; set; } = true;
|
|
||||||
|
|
||||||
protected override void OnInitialized()
|
|
||||||
{
|
|
||||||
IsLoading = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
namespace GameIdeas.BlazorApp.Pages.Games;
|
||||||
|
|
||||||
|
public enum AddType
|
||||||
|
{
|
||||||
|
Manual,
|
||||||
|
Auto
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AddTypeParams(AddType addType, string label)
|
||||||
|
{
|
||||||
|
public AddType AddType { get; set; } = addType;
|
||||||
|
public string? Label { get; set; } = label;
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
namespace GameIdeas.BlazorApp.Pages.Games.Components
|
namespace GameIdeas.BlazorApp.Pages.Games.Components;
|
||||||
{
|
|
||||||
public partial class GameHeader
|
public partial class GameHeader
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,15 @@
|
|||||||
@page "/Games"
|
@page "/Games"
|
||||||
@using GameIdeas.BlazorApp.Layouts
|
@using GameIdeas.BlazorApp.Layouts
|
||||||
@using GameIdeas.BlazorApp.Shared.Components
|
@using GameIdeas.BlazorApp.Shared.Components
|
||||||
|
@using GameIdeas.BlazorApp.Shared.Headers
|
||||||
@using GameIdeas.Resources
|
@using GameIdeas.Resources
|
||||||
|
|
||||||
@layout MainLayout
|
@layout MainLayout
|
||||||
|
|
||||||
<PageTitle>@ResourcesKey.GamesIdeas</PageTitle>
|
<PageTitle>@ResourcesKey.GamesIdeas</PageTitle>
|
||||||
|
|
||||||
<HeaderLayout>
|
<HeaderBase>
|
||||||
<Body>
|
<Body>
|
||||||
<div class="temp">Prout</div>
|
<div>PROUT</div>
|
||||||
</Body>
|
</Body>
|
||||||
</HeaderLayout>
|
</HeaderBase>
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
|
using GameIdeas.BlazorApp.Shared.Headers;
|
||||||
|
|
||||||
namespace GameIdeas.BlazorApp.Pages.Games;
|
namespace GameIdeas.BlazorApp.Pages.Games;
|
||||||
|
|
||||||
public partial class GamesBase ()
|
public partial class GamesBase ()
|
||||||
{
|
{
|
||||||
|
private HeaderBase? Header;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
@typeparam TItem
|
||||||
|
|
||||||
|
<div @ref=Content class="dropdown-container" tabindex="1000"
|
||||||
|
@onfocusout=HandlerDropdownAddFocusOut>
|
||||||
|
<div class="dropdown-content @(ContentVisile ? string.Empty : "invisible") @(Enum.GetName(Theme)?.ToLower())">
|
||||||
|
@foreach (var item in Items)
|
||||||
|
{
|
||||||
|
<div class="drowdown-element @(Enum.GetName(Theme)?.ToLower())" @onclick=HandleItemClicked>
|
||||||
|
@(LabelSelector != null ? LabelSelector.Invoke(item) : item?.ToString())
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
namespace GameIdeas.BlazorApp.Shared.Components.Dropdown;
|
||||||
|
|
||||||
|
public partial class DropdownContent<TItem>
|
||||||
|
{
|
||||||
|
[Parameter] public TItem? Value { get; set; }
|
||||||
|
[Parameter] public EventCallback<TItem?> ValueChanged { get; set; }
|
||||||
|
[Parameter] public IEnumerable<TItem> Items { get; set; } = [];
|
||||||
|
[Parameter] public Func<TItem, string>? LabelSelector { get; set; }
|
||||||
|
[Parameter] public DropdownTheme Theme { get; set; }
|
||||||
|
|
||||||
|
private bool ContentVisile = false;
|
||||||
|
private DateTime ContentLastFocusOut = DateTime.Now;
|
||||||
|
private ElementReference Content;
|
||||||
|
|
||||||
|
public async Task OpenAsync()
|
||||||
|
{
|
||||||
|
if (DateTime.Now - ContentLastFocusOut >= TimeSpan.FromSeconds(0.2))
|
||||||
|
{
|
||||||
|
await Content.FocusAsync();
|
||||||
|
ContentVisile = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close() => ContentVisile = false;
|
||||||
|
|
||||||
|
private void HandlerDropdownAddFocusOut()
|
||||||
|
{
|
||||||
|
ContentLastFocusOut = DateTime.Now;
|
||||||
|
ContentVisile = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task HandleItemClicked() => await ValueChanged.InvokeAsync(Value);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
.dropdown-content {
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
border-radius: var(--small-radius);
|
||||||
|
position: fixed;
|
||||||
|
animation-name: fade-in;
|
||||||
|
animation-duration: 0.4s
|
||||||
|
}
|
||||||
|
|
||||||
|
.drowdown-element {
|
||||||
|
width: fit-content;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drowdown-element:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invisible {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown-content.navigation {
|
||||||
|
gap: 4px;
|
||||||
|
background: var(--violet);
|
||||||
|
box-shadow: var(--drop-shadow);
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drowdown-element.navigation:hover {
|
||||||
|
color: var(--light-grey);
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace GameIdeas.BlazorApp.Shared.Components.Dropdown;
|
||||||
|
|
||||||
|
public enum DropdownTheme
|
||||||
|
{
|
||||||
|
Navigation
|
||||||
|
}
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
|
|
||||||
namespace GameIdeas.BlazorApp.Shared.Components;
|
|
||||||
|
|
||||||
public partial class HeaderLayout : LayoutComponentBase
|
|
||||||
{
|
|
||||||
private bool AddButtonsVisile = false;
|
|
||||||
private DateTime AddButtonsLastOut = DateTime.Now;
|
|
||||||
private ElementReference DropdownAdd;
|
|
||||||
|
|
||||||
private void HandleIconClicked()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task HandleMoreAddClickedAsync()
|
|
||||||
{
|
|
||||||
if (DateTime.Now - AddButtonsLastOut >= TimeSpan.FromSeconds(0.2))
|
|
||||||
{
|
|
||||||
await DropdownAdd.FocusAsync();
|
|
||||||
AddButtonsVisile = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void HandlerDropdownAddFocusOut()
|
|
||||||
{
|
|
||||||
AddButtonsLastOut = DateTime.Now;
|
|
||||||
AddButtonsVisile = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
@using GameIdeas.Resources
|
@using GameIdeas.BlazorApp.Shared.Components.Dropdown
|
||||||
@inherits LayoutComponentBase
|
@using GameIdeas.BlazorApp.Pages.Games
|
||||||
|
@using GameIdeas.Resources
|
||||||
|
|
||||||
<div class="header-tab">
|
<div class="header-tab">
|
||||||
<div class="icon-container" @onclick="HandleIconClicked">
|
<div class="icon-container" @onclick="HandleIconClicked">
|
||||||
@@ -16,24 +17,18 @@
|
|||||||
<path d="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z" />
|
<path d="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z" />
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<div class="second-button button" @onclick=HandleMoreAddClickedAsync>
|
<div class="second-button button" @onclick=HandleMoreButton>
|
||||||
<svg class="button-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
<svg class="button-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||||
<path d="M1 3H23L12 22" />
|
<path d="M1 3H23L12 22" />
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<DropdownContent @ref="DropdownAdd"
|
||||||
<div @ref=DropdownAdd class="dropdown-container" tabindex="1000"
|
TItem="AddTypeParams"
|
||||||
@onfocusout=HandlerDropdownAddFocusOut>
|
ValueChanged=HandleAddTypeClickedAsync
|
||||||
<div class="dropdown-more-add @(AddButtonsVisile ? string.Empty : "invisible")">
|
Items="AddTypes"
|
||||||
<div class="drowdown-more-element">
|
LabelSelector="(addtype => addtype.Label)"
|
||||||
@ResourcesKey.ManualAdd
|
Theme="DropdownTheme.Navigation" />
|
||||||
</div>
|
|
||||||
<div class="drowdown-more-element">
|
|
||||||
@ResourcesKey.AutoAdd
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="icon-container">
|
<div class="icon-container">
|
||||||
<svg class="account-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
<svg class="account-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using GameIdeas.BlazorApp.Pages.Games;
|
||||||
|
using GameIdeas.BlazorApp.Shared.Components.Dropdown;
|
||||||
|
using GameIdeas.Resources;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
namespace GameIdeas.BlazorApp.Shared.Headers;
|
||||||
|
|
||||||
|
public partial class HeaderBase
|
||||||
|
{
|
||||||
|
[Parameter] public RenderFragment? Body { get; set; }
|
||||||
|
[Parameter] public EventCallback<AddType> AddTypeChanged { get; set; }
|
||||||
|
|
||||||
|
private DropdownContent<AddTypeParams>? DropdownAdd;
|
||||||
|
private readonly IEnumerable<AddTypeParams> AddTypes =
|
||||||
|
[
|
||||||
|
new AddTypeParams(AddType.Manual, ResourcesKey.ManualAdd),
|
||||||
|
new AddTypeParams(AddType.Auto, ResourcesKey.AutoAdd)
|
||||||
|
];
|
||||||
|
|
||||||
|
private void HandleIconClicked()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
private async Task HandleMoreButton()
|
||||||
|
{
|
||||||
|
if (DropdownAdd != null)
|
||||||
|
{
|
||||||
|
await DropdownAdd.OpenAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private async Task HandleAddTypeClickedAsync(AddTypeParams value)
|
||||||
|
{
|
||||||
|
await AddTypeChanged.InvokeAsync(value.AddType);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -70,34 +70,6 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.account-icon {
|
.account-icon {
|
||||||
fill: var(--light-grey);
|
fill: var(--light-grey);
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown-more-add {
|
|
||||||
margin-top: 0px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 4px;
|
|
||||||
background: var(--violet);
|
|
||||||
box-shadow: var(--drop-shadow);
|
|
||||||
border-radius: var(--small-radius);
|
|
||||||
position: fixed;
|
|
||||||
padding: 4px;
|
|
||||||
animation-name: fade-in;
|
|
||||||
animation-duration: 0.4s
|
|
||||||
}
|
|
||||||
|
|
||||||
.drowdown-more-element {
|
|
||||||
width: fit-content;
|
|
||||||
}
|
|
||||||
|
|
||||||
.drowdown-more-element:hover {
|
|
||||||
color: var(--light-grey);
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.invisible {
|
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
@@ -29,10 +29,6 @@ html, body, #app {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*#app {
|
|
||||||
background: var(--background);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
h1:focus {
|
h1:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
@@ -69,6 +65,7 @@ a, .btn-link {
|
|||||||
|
|
||||||
#blazor-error-ui {
|
#blazor-error-ui {
|
||||||
color-scheme: light only;
|
color-scheme: light only;
|
||||||
|
color: #000;
|
||||||
background: lightyellow;
|
background: lightyellow;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
|
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Game Ideas</title>
|
<title>Game Ideas</title>
|
||||||
<base href="/Games" />
|
<base href="/" />
|
||||||
<link rel="stylesheet" href="css/app.css" />
|
<link rel="stylesheet" href="css/app.css" />
|
||||||
<link rel="icon" type="image/png" href="icon.png" />
|
<link rel="icon" type="image/png" href="icon.png" />
|
||||||
<link href="GameIdeas.BlazorApp.styles.css" rel="stylesheet" />
|
<link href="GameIdeas.BlazorApp.styles.css" rel="stylesheet" />
|
||||||
|
|||||||
Reference in New Issue
Block a user