File tree Expand file tree Collapse file tree 5 files changed +71
-6
lines changed
Expand file tree Collapse file tree 5 files changed +71
-6
lines changed Original file line number Diff line number Diff line change 11@using System .ComponentModel .DataAnnotations
22
33@code {
4- [Required ] [Parameter ] public string ImagePath { get ; set ; }
5- [Required ] [Parameter ] public string Description { get ; set ; }
4+ [Required ] [Parameter ] public string ImagePath { get ; set ; } = " # " ;
5+ [Required ] [Parameter ] public string Description { get ; set ; } = " NA " ;
66 [Parameter ] public int Number { get ; set ; }
77
88 private bool IsMagnified { get ; set ; } = false ;
Original file line number Diff line number Diff line change 1+ using System . Collections . Generic ;
2+
3+ namespace TestArena . Blog . Common . NavigationUtils
4+ {
5+ public static class SiteMap
6+ {
7+ public static List < PageInfo > Pages { get ; } = new List < PageInfo >
8+ {
9+ new ( "Intro to PACT for .NET Core: API contract testing" , "/blog/contract-testing-pact-net-intro" ) ,
10+ new ( "Intro to PACT for .NET Core: Events based systems" , "/blog/contract-testing-in-pact-with-events" ) ,
11+ new ( "Intro to PACT for .NET Core: Integration with PactFlow" , "/blog/integration-with-pactflow" )
12+ } ;
13+ }
14+
15+ public class PageInfo
16+ {
17+ public string Header { get ; }
18+ public string RelativePath { get ; }
19+
20+ public PageInfo ( string header , string relativePath )
21+ {
22+ Header = header ;
23+ RelativePath = relativePath ;
24+ }
25+ }
26+ }
Original file line number Diff line number Diff line change 22@using TestArena .Blog .Common
33
44<BlogContainer >
5- <Header Title =" Intro to PACT for .NET Core: API contract testing "
5+ <Header Title =" Intro to PACT for .NET Core: Events based systems "
66 Image =" images/blog/pact/events-demo/contract-testing-events.webp" PublishedOn =" @DateTime.Now" Authors =" Ajay Kumar" >
77 </Header >
88
Original file line number Diff line number Diff line change 1313 </div >
1414
1515 <!-- Search bar in the center -->
16- <div class =" col-12 col-md-4 d-flex justify-content-md-center justify-content-center mt-2 mt-md-0" >
17- <input type =" text" class =" form-control w-75" placeholder =" Search..." >
18- </div >
16+ <HeaderSearchBar />
1917
2018 <!-- Settings button on the right -->
2119 <div class =" col-12 col-md-4 d-flex justify-content-md-end justify-content-center mt-2 mt-md-0" >
Original file line number Diff line number Diff line change 1+ @using TestArena .Layout
2+ @using TestArena .Blog .Common .NavigationUtils
3+
4+ <div class =" col-12 col-md-4 d-flex justify-content-md-center justify-content-center mt-2 mt-md-0" >
5+ <div class =" w-75 position-relative" >
6+ <input type =" text" class =" form-control" placeholder =" Search..." @oninput =" FilterPages" >
7+ <ul class =" list-group position-absolute w-100 mt-1" style =" z-index : 1000 ;" hidden =" @(!FilteredPages.Any())" >
8+ @foreach ( var filteredPage in FilteredPages )
9+ {
10+ <li class =" list-group-item p-0" >
11+ <a href =" @filteredPage.RelativePath" class =" d-block text-decoration-none p-2" @onclick =" () => HideDropdown()" >@filteredPage.Header </a >
12+ </li >
13+ }
14+ </ul >
15+ </div >
16+ </div >
17+
18+ @code {
19+ private string SearchText { get ; set ; } = string .Empty ;
20+ private List <PageInfo > FilteredPages { get ; set ; } = new ();
21+
22+ private void FilterPages (ChangeEventArgs e )
23+ {
24+ SearchText = e .Value ? .ToString () ?? string .Empty ;
25+ if (string .IsNullOrWhiteSpace (SearchText ))
26+ {
27+ FilteredPages .Clear ();
28+ }
29+ else
30+ {
31+ FilteredPages = SiteMap .Pages
32+ .Where (page => page .Header .Contains (SearchText , StringComparison .OrdinalIgnoreCase ))
33+ .ToList ();
34+ }
35+ }
36+
37+ private void HideDropdown ()
38+ {
39+ FilteredPages .Clear ();
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments