@@ -13,7 +13,7 @@ class InformationWindow extends LitElement {
1313 constructor ( ) {
1414 super ( ) ;
1515 this . _restaurants = restaurants ;
16- this . _isChatExpanded = true ;
16+ this . _isChatExpanded = false ;
1717 this . _currentIndex = 0 ;
1818
1919 // ResizeObserver is used primarily to exercise this API as part of the benchmark.
@@ -72,6 +72,11 @@ class InformationWindow extends LitElement {
7272 }
7373 }
7474
75+ _goToCard ( index ) {
76+ this . _currentIndex = index ;
77+ this . updateCarousel ( ) ;
78+ }
79+
7580 updateCarousel ( ) {
7681 const cardRow = this . shadowRoot . querySelector ( ".card-row" ) ;
7782 if ( cardRow )
@@ -82,37 +87,59 @@ class InformationWindow extends LitElement {
8287
8388 _getExpandedTemplate ( ) {
8489 return html `
85- < div class ="relative w-full overflow-hidden ">
90+ < div class ="relative w-full overflow-hidden rounded-xl border border-teal-700 bg-gradient-to-b from-teal-50 to-white p-6 shadow-xl ">
8691 < button
87- class ="absolute left-2 top-1/2 z-10 flex h-8 w-8 -translate-y-1/2 transform cursor-pointer items-center justify-center rounded-full border-0 bg-black bg-opacity -50 p-2 text-white disabled:cursor-not-allowed disabled:opacity-50 "
92+ class ="absolute left-6 top-1/2 z-10 flex h-12 w-12 -translate-y-1/2 cursor-pointer items-center justify-center rounded-full border-2 border-teal-600 bg-white text-teal-700 shadow-lg hover: bg-teal -50 focus:outline-none focus:ring-4 focus:ring-teal-400 focus:ring-opacity-50 disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none "
8893 @click ="${ this . previousCard } "
8994 ?disabled ="${ this . _currentIndex === 0 } "
95+ aria-label ="Previous restaurant "
9096 >
91- <
97+ < svg class ="h-6 w-6 " fill ="none " stroke ="currentColor " viewBox ="0 0 24 24 ">
98+ < path stroke-linecap ="round " stroke-linejoin ="round " stroke-width ="2 " d ="M15 19l-7-7 7-7 "> </ path >
99+ </ svg >
92100 </ button >
93101 < div class ="card-row flex w-full ">
94- ${ this . _restaurants . map ( ( restaurant ) => html ` < restaurant-card title ="${ restaurant . title } " distance ="${ restaurant . distance } " rating ="${ restaurant . rating } " class ="box-border w-full flex-none p-2 "> </ restaurant-card > ` ) }
102+ ${ this . _restaurants . map ( ( restaurant ) => html ` < restaurant-card title ="${ restaurant . title } " distance ="${ restaurant . distance } " rating ="${ restaurant . rating } " class ="box-border w-full flex-none p-3 "> </ restaurant-card > ` ) }
95103 </ div >
96104 < button
97105 id ="next-restaurant-btn "
98- class ="absolute right-2 top-1/2 z-10 flex h-8 w-8 -translate-y-1/2 transform cursor-pointer items-center justify-center rounded-full border-0 bg-black bg-opacity -50 p-2 text-white disabled:cursor-not-allowed disabled:opacity-50 "
106+ class ="absolute right-6 top-1/2 z-20 flex h-12 w-12 -translate-y-1/2 cursor-pointer items-center justify-center rounded-full border-2 border-teal-600 bg-white text-teal-700 shadow-lg hover: bg-teal -50 focus:outline-none focus:ring-4 focus:ring-teal-400 focus:ring-opacity-50 disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none "
99107 @click ="${ this . nextCard } "
100108 ?disabled ="${ this . _currentIndex === this . _restaurants . length - 1 } "
109+ aria-label ="Next restaurant "
101110 >
102- >
111+ < svg class ="h-6 w-6 " fill ="none " stroke ="currentColor " viewBox ="0 0 24 24 ">
112+ < path stroke-linecap ="round " stroke-linejoin ="round " stroke-width ="2 " d ="M9 5l7 7-7 7 "> </ path >
113+ </ svg >
103114 </ button >
115+
116+ <!-- Pagination Dots -->
117+ < div class ="mt-4 flex justify-center space-x-2 ">
118+ ${ this . _restaurants . map (
119+ ( _ , index ) => html `
120+ < button class ="${ index === this . _currentIndex ? "bg-teal-600 w-6" : "bg-teal-300 hover:bg-teal-400" } h-2 w-2 rounded-full " @click ="${ ( ) => this . _goToCard ( index ) } " aria-label ="Go to restaurant ${ index + 1 } "> </ button >
121+ `
122+ ) }
123+ </ div >
104124 </ div >
105125 ` ;
106126 }
107127
108128 _getGridTemplate ( ) {
109- return html ` < div class ="grid grid-cols-2 gap-4 "> ${ this . _restaurants . map ( ( restaurant ) => html ` < restaurant-card title ="${ restaurant . title } " distance ="${ restaurant . distance } " rating ="${ restaurant . rating } "> </ restaurant-card > ` ) } </ div > ` ;
129+ return html `
130+ < div class ="to-teal-25 rounded-xl border border-teal-700 bg-gradient-to-br from-teal-50 via-white p-6 shadow-xl ">
131+ < div class ="grid grid-cols-2 gap-6 "> ${ this . _restaurants . map ( ( restaurant ) => html ` < restaurant-card title ="${ restaurant . title } " distance ="${ restaurant . distance } " rating ="${ restaurant . rating } "> </ restaurant-card > ` ) } </ div >
132+ </ div >
133+ ` ;
110134 }
111135
112136 render ( ) {
113137 return html `
114138 < div class ="p-1 xl:p-8 ">
115- < h4 class ="my-1 mb-1 text-base font-semibold text-gray-700 "> Restaurants Near You</ h4 >
139+ < div class ="mb-6 flex items-center justify-between ">
140+ < h4 class ="text-xl font-bold text-teal-800 "> Restaurants Near You</ h4 >
141+ < div class ="rounded-lg bg-teal-100 px-3 py-1 text-sm font-medium text-teal-700 "> ${ this . _restaurants . length } found</ div >
142+ </ div >
116143 ${ this . _isChatExpanded ? this . _getExpandedTemplate ( ) : this . _getGridTemplate ( ) }
117144 </ div >
118145 ` ;
0 commit comments