11"use client" ;
22
3- import { MagnifyingGlass } from '@phosphor-icons/react/dist/ssr/MagnifyingGlass' ;
4- import type { ComponentProps , ReactNode } from "react" ;
3+ import { MagnifyingGlass } from "@phosphor-icons/react/dist/ssr/MagnifyingGlass" ;
4+ import clsx from "clsx" ;
5+ import type { ReactNode } from "react" ;
6+ import { Button as BaseButton } from "react-aria-components" ;
57
8+ import type { Props as ButtonProps } from "../Button" ;
69import { Button } from "../Button" ;
710import styles from "./index.module.scss" ;
811
9-
1012type OwnProps = {
1113 largeScreenContent ?: ReactNode ;
1214 smallScreenContent ?: ReactNode ;
1315} ;
1416
15- type Props = Pick <
16- ComponentProps < typeof Button > ,
17- ' beforeIcon' | ' size' | ' onClick'
17+ type Props = Pick <
18+ ButtonProps < typeof BaseButton > ,
19+ " beforeIcon" | " size" | " onClick" | "className" | "isPending"
1820> &
1921 OwnProps ;
20-
22+
2123export const SearchButton = ( {
2224 beforeIcon,
2325 largeScreenContent,
@@ -26,28 +28,27 @@ export const SearchButton = ({
2628} : Props ) => {
2729 return (
2830 < div className = { styles . searchButton } >
29- < Button
30- className = { styles . largeScreenSearchButton ?? "" }
31- variant = "outline"
32- beforeIcon = { beforeIcon ?? < MagnifyingGlass /> }
33- size = "sm"
34- rounded
35-
36- { ...props }
37- >
38- { largeScreenContent }
39- </ Button >
40- < Button
41- className = { styles . smallScreenSearchButton ?? "" }
42- hideText
43- variant = "ghost"
44- beforeIcon = { beforeIcon ?? < MagnifyingGlass /> }
45- size = "sm"
46- rounded
47- { ...props }
48- >
49- { smallScreenContent }
50- </ Button >
51- </ div >
31+ < Button
32+ className = { clsx ( styles . largeScreenSearchButton , props . className ) }
33+ variant = "outline"
34+ beforeIcon = { beforeIcon ?? < MagnifyingGlass /> }
35+ size = "sm"
36+ rounded
37+ { ...props }
38+ >
39+ { largeScreenContent }
40+ </ Button >
41+ < Button
42+ className = { clsx ( styles . smallScreenSearchButton , props . className ) }
43+ hideText
44+ variant = "ghost"
45+ beforeIcon = { beforeIcon ?? < MagnifyingGlass /> }
46+ size = "sm"
47+ rounded
48+ { ...props }
49+ >
50+ { smallScreenContent }
51+ </ Button >
52+ </ div >
5253 ) ;
5354} ;
0 commit comments