-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.astro
42 lines (33 loc) · 853 Bytes
/
index.astro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
import { Search as SearchIcon } from '@images/components'
import Search from './Search.tsx'
---
<button id="search-button" type="button" title="Search" class="searchButton">
<SearchIcon />
</button>
<Search client:only="react" />
<script>
import { isSearchOpen } from '@stores/search'
const button = document.querySelector('#search-button')
isSearchOpen.subscribe((value) =>
document.body.classList.toggle('hasSearchOpen', value)
)
button?.addEventListener('click', () => isSearchOpen.set(!isSearchOpen.get()))
</script>
<style>
.searchButton:focus {
outline: 0;
}
.searchButton svg {
width: 24px;
height: 24px;
stroke: var(--text-color-light);
}
.searchButton:hover svg,
.searchButton:focus svg {
stroke: var(--link-color);
}
:global(.hasSearchOpen) {
overflow: hidden;
}
</style>