Files
my-portfolio/BeauFindlay/src/BeauFindlay.Client/Pages/Home.razor
2024-03-13 23:04:57 +00:00

68 lines
2.3 KiB
Plaintext

@page "/"
@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've worked with businesses at all sizes and stages and 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've worked with businesses at all sizes and stages and I'm currently heading up the tech as CTO at a cool startup called <Anchor Href="https://unhurd.co.uk">un:hurd</Anchor>.</p>
}
@code {
private const string ComponentKey = "ComponentRendered_Home";
private bool hasPreviouslyRendered;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
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();
}
}
}
}