Skip to content

Commit

Permalink
Merge pull request #85 from Brixel/joren/feat/homepage
Browse files Browse the repository at this point in the history
Joren/feat/homepage
  • Loading branch information
BerendWouters authored Aug 23, 2022
2 parents 9424efb + 29081de commit db20ace
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 12 deletions.
9 changes: 1 addition & 8 deletions Web/Pages/Account/RedirectToLogin.razor
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
@inject NavigationManager Navigation

@code {
protected override void OnInitialized()
{
Navigation.NavigateTo("Account/Login", true);
}
}
<RedirectTo Uri="Account/Login"></RedirectTo>
20 changes: 20 additions & 0 deletions Web/Pages/Public/About.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@page "/about"
@using System.Reflection

<h3 class="my-6">About</h3>

<MudText Typo="Typo.body1">Version: @_version</MudText>

@code {

private string _version
{
get
{
var assembly = Assembly.GetExecutingAssembly();
var gitVersionInformationType = assembly.GetType("GitVersionInformation");
var fullSemVerField = gitVersionInformationType?.GetField("FullSemVer");
return fullSemVerField?.GetValue(null)?.ToString() ?? "0.0.0";
}
}
}
29 changes: 29 additions & 0 deletions Web/Pages/Public/Home.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@page "/home"
@inject NavigationManager Navigation

<h1 class="my-6">Welcome to HaSpMan</h1>

<div class="button-row">
<CardButton Icon="@Icons.Filled.PersonAdd" OnClick="@(() => Navigate("/members/new"))">
Add Member
</CardButton>

<CardButton Icon="@Icons.Filled.People" OnClick="@(() => Navigate("/members"))">
List Members
</CardButton>

<CardButton Icon="@Icons.Filled.CompareArrows" OnClick="@(() => Navigate("/transactions/new"))">
Add Transaction
</CardButton>

<CardButton Icon="@Icons.Filled.List" OnClick="@(() => Navigate("/transactions"))">
List Transactions
</CardButton>
</div>

@code {
void Navigate(string uri)
{
Navigation.NavigateTo(uri, true);
}
}
8 changes: 8 additions & 0 deletions Web/Pages/Public/Home.razor.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.button-row {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
flex-wrap: wrap;
gap: 3rem;
}
2 changes: 2 additions & 0 deletions Web/Pages/Public/Index.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@page "/"
<RedirectTo Uri="home"></RedirectTo>
20 changes: 20 additions & 0 deletions Web/Shared/CardButton.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<MudCard Class="card">
<MudCardContent Class="pa-0">
<div class="pa-9 button" @onclick="OnClick">
<MudIcon Icon="@Icon"></MudIcon>
<MudText Class="mt-3" Typo="Typo.h6">@ChildContent</MudText>
</div>
</MudCardContent>
</MudCard>

@code {

[Parameter]
public string Icon { get; set; } = string.Empty;

[Parameter]
public RenderFragment? ChildContent { get; set; }

[Parameter]
public EventCallback OnClick { get; set; }
}
25 changes: 25 additions & 0 deletions Web/Shared/CardButton.razor.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.button {
min-width: 10rem;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
cursor: pointer;
}

.button:hover {
filter: blur(50);
background-color: #DDDDDD;
}

::deep .mud-paper.mud-card {
background-color: red;
}

::deep .mud-icon-root.mud-svg-icon {
font-size: 5rem;
}

::deep .mud-icon-root.mud-svg-icon path {
color: #4a4657;
}
7 changes: 3 additions & 4 deletions Web/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
Edge="Edge.Start"
Icon="@Icons.Material.Filled.Menu"
OnClick="@((e) => DrawerToggle())" />
<MudText Class="ml-3"
Typo="Typo.h5">
HaSpMan @_version
<MudText Class="ml-3" Typo="Typo.h5">
<a class="title" href="home">HaSpMan @_version</a>
</MudText>
<MudSpacer />
<MudMenu Icon="@Icons.Material.Filled.MoreVert">
<MudMenu Color="Color.Inherit" Icon="@Icons.Material.Filled.MoreVert">
<AuthorizeView>
<Authorized>
<MudMenuItem>
Expand Down
3 changes: 3 additions & 0 deletions Web/Shared/MainLayout.razor.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.title {
color: white;
}
11 changes: 11 additions & 0 deletions Web/Shared/RedirectTo.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@inject NavigationManager Navigation

@code {
[Parameter]
public string Uri { get; set; } = string.Empty;

protected override void OnInitialized()
{
Navigation.NavigateTo(Uri, true);
}
}

0 comments on commit db20ace

Please sign in to comment.