Skip to content

Commit

Permalink
fix: Add classname to SeachSuggest close
Browse files Browse the repository at this point in the history
  • Loading branch information
3y3 committed Oct 16, 2024
1 parent 2e44e11 commit 93fa25b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/SearchSuggest/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface SearchSuggestProps {
provider: ISearchProvider;
placeholder?: string;
classNameContainer?: string;
classNameClose?: string;
className?: string;
onFocus?: (event: SyntheticEvent) => void;
onBlur?: (event: SyntheticEvent) => void;
Expand All @@ -47,14 +48,14 @@ export interface SearchSuggestApi {

const MIMIC_PC_CONTROL = 'pc-control pc-control_size_l pc-control_theme_primary';

function CloseButton({onClick}: {onClick: MouseEventHandler}) {
function CloseButton({onClick, className}: {onClick: MouseEventHandler; className?: string}) {
const {t} = useTranslation('search');

return (
<button
type="button"
aria-label={t('search_close')}
className={b('close', MIMIC_PC_CONTROL)}
className={b('close', [MIMIC_PC_CONTROL, className].join(' '))}
onClick={onClick}
>
<Icon data={Xmark} size={24} />
Expand All @@ -69,6 +70,7 @@ export const SearchSuggest = forwardRef<SearchSuggestApi, SearchSuggestProps>((p
provider,
className,
classNameContainer,
classNameClose,
placeholder = t('search_placeholder'),
endContent,
closeButton,
Expand Down Expand Up @@ -166,7 +168,7 @@ export const SearchSuggest = forwardRef<SearchSuggestApi, SearchSuggestProps>((p
active === undefined ? undefined : `dc-${id}-list-item-${active}`,
}}
/>
{closeButton && focused && <CloseButton onClick={onClose} />}
{closeButton && focused && <CloseButton onClick={onClose} className={classNameClose} />}
{input.current && (
<Popup
open={Boolean(query && focused)}
Expand Down

0 comments on commit 93fa25b

Please sign in to comment.