@code { [Inject] private ScrollService ScrollService { get; set; } = default!; private string currentSection = "home"; protected override async Task OnInitializedAsync() { ScrollService.OnSectionChanged += HandleSectionChange; } private void HandleSectionChange(string sectionId) { currentSection = sectionId; StateHasChanged(); } private async Task ScrollToHome() => await ScrollService.ScrollToSection("home"); private async Task ScrollToAboutMe() => await ScrollService.ScrollToSection("about_me"); private async Task ScrollToApps() => await ScrollService.ScrollToSection("apps"); private async Task ScrollToGames() => await ScrollService.ScrollToSection("games"); public void Dispose() { ScrollService.OnSectionChanged -= HandleSectionChange; } }