Skip to content

Commit 6c806f4

Browse files
committed
add router
1 parent 5a18e27 commit 6c806f4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

app/[locale]/(user)/components/Content.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1+
'use client'
2+
13
import Image from 'next/image';
4+
import { useRouter } from 'next/navigation';
25
import { SearchInput, Text } from 'opub-ui';
36

47
import { cn } from '@/lib/utils';
58
import Styles from '../page.module.scss';
69

710
export const Content = () => {
11+
const router = useRouter();
12+
const handleSearch = (value: string) => {
13+
if (value) {
14+
router.push(`/datasets?query=${encodeURIComponent(value)}`);
15+
}
16+
};
817
return (
918
<main>
1019
<div className="flex items-center justify-center gap-20 bg-primaryBlue p-8 lg:p-16">
@@ -27,14 +36,15 @@ export const Content = () => {
2736
<div className="w-full">
2837
<SearchInput
2938
className={cn(Styles.Search)}
39+
onSubmit={handleSearch}
3040
label={''}
3141
placeholder="Search for any data"
3242
name={''}
3343
withButton
3444
/>
3545
</div>
3646
</div>
37-
<div className=' hidden lg:block'>
47+
<div className=" hidden lg:block">
3848
<Image
3949
src={'/homepage_illustartion.png'}
4050
width={500}

0 commit comments

Comments
 (0)