The Node.js® Website
1'use client';
2
3import type { ComponentProps, FC } from 'react';
4
5import Select from '@/components/Common/Select';
6import { useRouter } from '@/navigation.mjs';
7
8type WithSidebarSelectProps = Pick<
9 ComponentProps<typeof Select>,
10 'values' | 'defaultValue' | 'label'
11>;
12
13const WithRouterSelect: FC<WithSidebarSelectProps> = ({
14 values,
15 label,
16 defaultValue,
17}) => {
18 const { push } = useRouter();
19
20 return (
21 <Select
22 label={label}
23 values={values}
24 defaultValue={defaultValue}
25 onChange={value => push(value)}
26 />
27 );
28};
29
30export default WithRouterSelect;