Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.

Commit a3610e9

Browse files
Migrate Nim to Blazor
1 parent 7f64f2a commit a3610e9

42 files changed

Lines changed: 485 additions & 815 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Home/Components/GamesNavbar.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
<nav>
33
<div class="navSquare @(SelectedGameButton == GameButton.Nim ? "selected" : string.Empty)" id="nimButton">
44
<a @onclick="NavigateToNotNim">
5-
<img src="/images/home.webp" alt="Nim" />
5+
<img src="/images/games/nim-icon.png" alt="Nim" />
66
<div>Nim</div>
77
</a>
88
</div>
9-
<div class="navSquare @(SelectedGameButton == GameButton.Voronoi ? "selected" : string.Empty)" id="voronoiButton">
9+
<!--div class="navSquare @(SelectedGameButton == GameButton.Voronoi ? "selected" : string.Empty)" id="voronoiButton">
1010
<a @onclick="NavigateToVoronoi">
1111
<img src="/images/blog.webp" alt="Voronoi" />
1212
<div>Voronoi</div>
1313
</a>
14-
</div>
14+
</div-->
1515
</nav>

Home/Components/GamesNavbar.razor.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,17 @@ namespace Home.Components;
44

55
public partial class GamesNavbar(NavigationManager NavManager) : ComponentBase
66
{
7-
[Parameter]
8-
public GameButton? SelectedGameButton { get; set; }
7+
public GameButton SelectedGameButton { get; set; } = GameButton.Nim;
98

109
protected override void OnInitialized()
1110
{
1211
GetSelectedGameButton();
13-
1412
base.OnInitialized();
1513
}
1614

1715
protected override void OnParametersSet()
1816
{
1917
GetSelectedGameButton();
20-
2118
base.OnParametersSet();
2219
}
2320

@@ -43,15 +40,10 @@ private void GetSelectedGameButton()
4340
{
4441
SelectedGameButton = GameButton.Voronoi;
4542
}
46-
else
47-
{
48-
SelectedGameButton = GameButton.None;
49-
}
5043
}
5144

5245
public enum GameButton
5346
{
54-
None,
5547
Nim,
5648
Voronoi
5749
}

Home/Components/GamesNavbar.razor.css

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ a img {
5454
from {
5555
transform:rotate(0deg);
5656
}
57-
57+
5858
to {
5959
transform:rotate(360deg);
6060
}
@@ -89,9 +89,11 @@ a img {
8989
nav {
9090
flex-direction: row;
9191
height: 70px;
92+
margin-bottom: 70px;
93+
margin-left: -70px;
9294
width: 100%;
93-
position: sticky;
94-
float: bottom;
95+
position: fixed;
96+
float: inline-end;
9597
}
9698

9799
.navSquare{

Home/Components/Navbar.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
<div>Blog</div>
1616
</a>
1717
</div>
18-
<!--div class="navSquare @(SelectedNavButton == NavButton.Games ? "selected" : string.Empty)" id="gamesButton">
18+
<div class="navSquare @(SelectedNavButton == NavButton.Games ? "selected" : string.Empty)" id="gamesButton">
1919
<a @onclick="NavigateToGames">
20-
<img src="/images/blog.webp" alt="Games" />
20+
<img src="/images/games/games.png" alt="Games" />
2121
<div>Games</div>
2222
</a>
23-
</div-->
23+
</div>
2424
</nav>

Home/Components/Navbar.razor.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,13 @@ protected void NavigateToBlog()
5151

5252
protected void NavigateToGames()
5353
{
54+
if (SelectedNavButton == NavButton.Games)
55+
{
56+
return;
57+
}
58+
5459
SelectedNavButton = NavButton.Games;
55-
NavManager.NavigateTo("/games");
60+
NavManager.NavigateTo("/games/nim");
5661
}
5762

5863
// For legacy blog URLs, /{Year}/{Month}/{Day}/{Slug}
@@ -65,7 +70,7 @@ private void SetSelectedNavButton()
6570
{
6671
SelectedNavButton = NavButton.Blog;
6772
}
68-
else if (NavManager.Uri.Contains("/games")) // Legacy games don't use this navbar so they don't matter
73+
else if (NavManager.Uri.Contains("/games"))
6974
{
7075
SelectedNavButton = NavButton.Games;
7176
}

Home/Components/Navbar.razor.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ a img {
5353
from {
5454
transform:rotate(0deg);
5555
}
56-
56+
5757
to {
5858
transform:rotate(360deg);
5959
}
@@ -88,8 +88,8 @@ a img {
8888
flex-direction: row;
8989
height: 70px;
9090
width: 100%;
91-
position: sticky;
92-
float: bottom;
91+
position: fixed;
92+
float: inline-end;
9393
}
9494

9595
.navSquare{

Home/Layout/GamesLayout.razor

Lines changed: 0 additions & 9 deletions
This file was deleted.

Home/Layout/GamesLayout.razor.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

Home/Layout/GamesLayout.razor.css

Lines changed: 0 additions & 26 deletions
This file was deleted.

Home/Layout/MainLayout.razor

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
@using Home.Components
33

44
<h1 style="display:none;">My Website and Blog</h1>
5-
<div class="container">
5+
<div class="@ContainerClass">
66
@Body
77
</div>
88

9+
@if (ShowGamesNavbar)
10+
{
11+
<GamesNavbar />
12+
}
13+
914
<Navbar />

0 commit comments

Comments
 (0)