Closed pkong-ds closed 4 months ago
Suggestion:
Search.astro
<div class="the-search-input-container">
<input id="the-search-input" />
</div>
<style>
.the-search-input-container {
..
}
.the-search-input {
..
}
</style>
<script>
document.getElementByID('the-search-input').addEventListener('keyup', () => {
....
})
</script>
In base layout, introduce a named slot
<html>
...
<body>
...
<header>
...
<slot name="header-center" />
...
</header>
...
</body>
</html>
Then, in the specified page component
<BaseLayout>
<TheSearchComponent slot="header-center" />
</BaseLayout>
Agree with SearchComponent Disagree with usage of slot
Will do SearchComponent refactoring later 👍
Preview
<=640px
>640px