Move and rename Blazor project
This commit is contained in:
82
BeauFindlay/src/BeauFindlay.Client/Pages/Home.razor
Normal file
82
BeauFindlay/src/BeauFindlay.Client/Pages/Home.razor
Normal file
@@ -0,0 +1,82 @@
|
||||
@page "/"
|
||||
|
||||
@implements IDisposable
|
||||
|
||||
@inject IJSRuntime JSRuntime
|
||||
|
||||
<PageTitle>Home - Beau Findlay</PageTitle>
|
||||
|
||||
@if (!hasPreviouslyRendered)
|
||||
{
|
||||
<h1 class="text-4xl">
|
||||
<Typewriter Text="Hi, I'm Beau."/>
|
||||
</h1>
|
||||
|
||||
<p class="text-xl mt-4">
|
||||
<Typewriter Name="@TypewriterConstants.Name.IntroComplete" Text="I'm a UK-based software engineer and I love building cool stuff."/>
|
||||
</p>
|
||||
|
||||
<h2 class="text-2xl mt-16 font-semibold">
|
||||
<Typewriter Text="A bit about me"/>
|
||||
</h2>
|
||||
|
||||
<p class="text-xl mt-4">
|
||||
<Typewriter Text="I mostly specialise in back-end C#/.NET development and I've built systems that scale for hundreds-of-thousands of global users."/>
|
||||
</p>
|
||||
|
||||
<p class="text-xl mt-4">
|
||||
<Typewriter Text="I'm currently heading up the tech as CTO at a cool startup called un:hurd."/>
|
||||
</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h1 class="text-4xl">Hi, I'm Beau.</h1>
|
||||
|
||||
<p class="text-xl mt-4">I'm a UK-based software engineer and I love building cool stuff.</p>
|
||||
|
||||
<h2 class="text-3xl mt-16 font-semibold">A bit about me</h2>
|
||||
|
||||
<p class="text-xl mt-4">I mostly specialise in back-end C#/.NET development and I've built systems that scale for hundreds-of-thousands of global users.</p>
|
||||
|
||||
<p class="text-xl mt-4">I'm currently heading up the tech as CTO at a cool startup called <a href="https://unhurd.co.uk" target="_blank" class="underline">un:hurd</a>.</p>
|
||||
}
|
||||
|
||||
|
||||
@code {
|
||||
private const string ComponentKey = "ComponentRendered_Home";
|
||||
private bool hasPreviouslyRendered;
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
Typewriter.OnAllTypingCompleted += HandleTypingCompleted;
|
||||
|
||||
var renderedBeforeAsString = await JSRuntime.InvokeAsync<string>("localStorage.getItem", ComponentKey);
|
||||
|
||||
var previousValue = hasPreviouslyRendered;
|
||||
hasPreviouslyRendered = !string.IsNullOrEmpty(renderedBeforeAsString) && bool.Parse(renderedBeforeAsString);
|
||||
|
||||
if (!hasPreviouslyRendered)
|
||||
{
|
||||
await JSRuntime.InvokeVoidAsync("localStorage.setItem", ComponentKey, "true");
|
||||
}
|
||||
|
||||
if (previousValue != hasPreviouslyRendered)
|
||||
{
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void HandleTypingCompleted()
|
||||
{
|
||||
Console.WriteLine("Typewriter finished typing.");
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Typewriter.OnAllTypingCompleted -= HandleTypingCompleted;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user