mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
feat: scroll to view home search
This commit is contained in:
1 parent
be7b00c4be
commit
5d6e864451
1 file changed
+13
-2
+13
-2
@@ -16,7 +16,7 @@ import {
|
||||
TextField,
|
||||
} from '@radix-ui/themes';
|
||||
import { go } from 'fuzzysort';
|
||||
import { debounce } from 'lodash';
|
||||
import { debounce, times } from 'lodash';
|
||||
import { useRef, useState } from 'react';
|
||||
import { Link } from '../components/Link';
|
||||
import { NAVBAR_HEIGHT } from '../components/Navbar';
|
||||
@@ -148,8 +148,15 @@ export default function Page() {
|
||||
if (!search.current) return;
|
||||
|
||||
const sanitized = search.current.value.trim();
|
||||
|
||||
setShowSearch(sanitized.length > 0);
|
||||
|
||||
window.scrollTo({
|
||||
top:
|
||||
search.current.getBoundingClientRect().top -
|
||||
NAVBAR_HEIGHT -
|
||||
32,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}}
|
||||
>
|
||||
<TextField.Slot>
|
||||
@@ -345,6 +352,10 @@ export default function Page() {
|
||||
</Flex>
|
||||
</Flex>
|
||||
|
||||
{times(64, () => (
|
||||
<br />
|
||||
))}
|
||||
|
||||
<div style={{ flex: 1 }} />
|
||||
</>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user