22import ButtonLink from " ../button-link/button-link.astro" ;
33import Button from " @ui/Button.astro" ;
44import HeaderButton from " ./header-button.astro" ;
5- import Search from " astro-pagefind/components/Search" ;
5+ import Search from " ../search/Search.astro" ;
6+ import Icon from " @ui/Icon.astro" ;
67
78export interface Props {
89 mobile? : boolean ;
@@ -13,146 +14,33 @@ const { mobile = false }: Props = Astro.props;
1314const IS_LIVE = false ;
1415---
1516
16- <div class =" flex items-center justify-end gap-2 w-1/3" >
17- <Search
18- id =" search"
19- className =" pagefind-ui"
20- uiOptions ={ {
21- showImages: false ,
22- translations: {
23- zero_results: " Couldn't find [SEARCH_TERM]" ,
24- },
25- }}
26- />
17+ <div class =" flex items-center justify-end gap-2 h-[85px]" >
18+ <Search />
19+ <div class =" ml-auto flex items-center " >
2720 {
28- ! mobile ? (
21+ ! mobile ?
2922 <>
30- <Button url = " /tickets" icon = " ticket" >Register Now!</Button >
31- { IS_LIVE && <Button url = " /live" >Live</Button >}
23+ <Button id = " searchButton" icon = " search" iconSize = " fa-xl" clear ></Button >
24+ <Button url = " /tickets" icon = " ticket" class = " max-xl:hidden" >Register Now!</Button >
25+ { IS_LIVE && <Button url = " /live" >Live</Button >}
3226 </>
33- ) : null
27+ : null
3428 }
3529
30+
3631 <label for =" nav_toggle" class =" flex xl:hidden" >
37- < HeaderButton variant = " menu " >
38- { mobile ? " Close Menu " : " Menu " }
39- </ HeaderButton >
32+ < span class = " w-[3em] h-[3em] font-bold text-lg px-4 py-4 rounded-lg inline-flex items-center justify-center leading-4 transition-colors duration-200 not-prose border hover:text-black bg-primary text-white hover:bg-primary-hover border-transparent " >
33+ { mobile ? < Icon name = " close " size = " fa-xl " /> : < Icon name = " bars " size = " fa-xl " /> }
34+ </ span >
4035 </label >
4136</div >
4237<script >
43- document.addEventListener("DOMContentLoaded", function () {
44- const searchContainer = document.querySelector(".pagefind-ui");
45- const searchInput = searchContainer?.querySelector("input");
46- let selectedIndex = -1;
47-
48- function updateSelection() {
49- const results = searchContainer?.querySelectorAll(".pagefind-ui__result");
50- if (!results) return;
38+ const searchButton = document.getElementById("searchButton");
39+ const searchWrapper = document.querySelector(".search-wrapper") as HTMLElement;
5140
52- results.forEach((result, index) => {
53- if (index === selectedIndex) {
54- result.classList.add("selected");
55- result.scrollIntoView({ block: "nearest", behavior: "smooth" });
56- } else {
57- result.classList.remove("selected");
58- }
41+ if (searchButton && searchWrapper) {
42+ searchButton.addEventListener("click", function () {
43+ searchWrapper.style.display = searchWrapper.style.display === "block" ? "none" : "block";
5944 });
6045 }
61-
62- document.addEventListener("keydown", function (event) {
63- if (!searchContainer || !searchInput) return;
64-
65- const results = searchContainer.querySelectorAll(".pagefind-ui__result");
66- if (document.activeElement === searchInput) {
67- if (event.key === "ArrowDown") {
68- event.preventDefault();
69- selectedIndex = (selectedIndex + 1) % results.length;
70- updateSelection();
71- } else if (event.key === "ArrowUp") {
72- event.preventDefault();
73- selectedIndex = (selectedIndex - 1 + results.length) % results.length;
74- updateSelection();
75- } else if (event.key === "Enter" && selectedIndex >= 0) {
76- event.preventDefault();
77- results[selectedIndex].querySelector("a")?.click();
78- }
79- }
80- });
81-
82- // Reset selection when the search query changes
83- searchInput?.addEventListener("input", function () {
84- selectedIndex = -1;
85- });
86- });
8746</script >
88- <style is:global >
89- .pagefind-ui__result.selected {
90- background-color: #f5f5f5;
91- background-image: linear-gradient(to right, #3684b6 7px, transparent 5px);
92- -webkit-transform: translate3d(0, 0, 0);
93- transform: translate3d(0, 0, 0);
94- }
95- .pagefind-ui__drawer {
96- }
97- .pagefind-ui__message {
98- margin: 1em;
99- }
100- .pagefind-ui__result mark {
101- background: #f9eb5d;
102- background-image: linear-gradient(to right, #f9eb5d 10%, #fcf4a7 100%);
103- margin: 4px;
104- padding-right: 6px;
105- padding-left: 6px;
106- padding-top: 2px;
107- padding-bottom: 2px;
108- color: #000000;
109- font-family: monospace;
110- border-radius: 4px;
111- }
112- .pagefind-ui {
113- --pagefind-ui-scale: 1;
114- --pagefind-ui-primary: #141f36;
115- --pagefind-ui-text: black;
116- --pagefind-ui-border: #d8d8d8;
117- --pagefind-ui-border-width: 2px;
118- --pagefind-ui-border-radius: 0;
119- width:50%;
120- min-width: 10vw;
121- }
122- .pagefind-ui.yellow {
123- --pagefind-ui-background: #efc302;
124- }
125- .pagefind-ui.red {
126- --pagefind-ui-background: #ffb9bb;
127- width: 50%;
128- }
129- .pagefind-ui .pagefind-ui__drawer:not(.pagefind-ui__hidden) {
130- position: absolute;
131- left: auto;
132- right: 0;
133- margin-top: 0px;
134- width: 50vw;
135- z-index: 9999;
136- overflow-y: auto;
137- box-shadow:
138- 0 10px 10px -5px rgba(0, 0, 0, 0.2),
139- 0 2px 2px 0 rgba(0, 0, 0, 0.1);
140- border-bottom-right-radius: var(--pagefind-ui-border-radius);
141- border-bottom-left-radius: var(--pagefind-ui-border-radius);
142- background-color: var(--pagefind-ui-background);
143- }
144- .pagefind-ui__result {
145- padding: 0 2em 1em !important;
146- }
147- .pagefind-ui .pagefind-ui__result-link {
148- color: var(--pagefind-ui-primary);
149- }
150- .pagefind-ui .pagefind-ui__result-excerpt {
151- color: var(--pagefind-ui-text);
152- }
153- @media (max-width: 1280px) {
154- .pagefind-ui {
155- display: none;
156- }
157- }
158- </style >
0 commit comments