import React, { forwardRef, useContext } from "react"; import { MagnifyingGlassIcon } from "@navikt/aksel-icons"; import { Button, ButtonProps } from "../../button"; import { cl, composeEventHandlers } from "../../utils/helpers"; import { useI18n } from "../../utils/i18n/i18n.hooks"; import { SearchContext } from "./context"; export interface SearchButtonProps extends Omit< ButtonProps, "size" | "children" | "variant" > { /** * Text set after icon */ children?: React.ReactNode; } export type SearchButtonType = React.ForwardRefExoticComponent< SearchButtonProps & React.RefAttributes >; const SearchButton: SearchButtonType = forwardRef( ({ className, children, disabled, onClick, ...rest }, ref) => { const translate = useI18n("Search"); const context = useContext(SearchContext); if (context === null) { console.warn(" has to be wrapped in "); return null; } const { size, variant, handleClick } = context; return ( ); }, ); export default SearchButton;