Skip to content

Commit 5b17800

Browse files
committed
align
1 parent 93f6f43 commit 5b17800

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

layouts/partials/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
</nav>
4747
</div>
4848
<div id="buttons" class="flex min-w-0 items-center justify-end gap-4 flex-shrink-0">
49-
<div class="topbar-button">
49+
<div class="topbar-button" id="search-bar-container">
5050
{{ partialCached "search-bar.html" "-" }}
5151
</div>
5252
<button

layouts/partials/search-bar.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,24 @@
4444
</span>
4545
</div>
4646
<div
47+
id="search-bar-dropdown"
4748
x-show="open"
4849
x-cloak
4950
x-ref="dropdown"
5051
x-init="$nextTick(() => {
5152
if (open) {
53+
const containerRect = document.getElementById('search-bar-container').getBoundingClientRect();
5254
const rect = $refs.searchBarRef.getBoundingClientRect();
5355
$el.style.top = (rect.bottom + window.scrollY + 9) + 'px';
54-
$el.style.left = (rect.right - Math.max(rect.width, 400)) + 'px';
56+
$el.style.left = (containerRect.right - Math.max(rect.width, 400)) + 'px';
5557
$el.style.width = Math.max(rect.width, 400) + 'px';
5658
}
5759
})"
5860
x-effect="if (open) {
61+
const containerRect = document.getElementById('search-bar-container').getBoundingClientRect();
5962
const rect = $refs.searchBarRef.getBoundingClientRect();
6063
$el.style.top = (rect.bottom + window.scrollY + 9) + 'px';
61-
$el.style.left = (rect.right - Math.max(rect.width, 400)) + 'px';
64+
$el.style.left = (containerRect.right - Math.max(rect.width, 400)) + 'px';
6265
$el.style.width = Math.max(rect.width, 400) + 'px';
6366
}"
6467
class="bg-background-light dark:bg-background-dark fixed z-[999] max-w-xl rounded-sm px-6 py-4 shadow-lg"

0 commit comments

Comments
 (0)