import * as React from 'react'; import cx from 'classnames'; import Input, {COLOR, SIZE} from '../form-elements/Input'; import type {InputPropsType} from '../form-elements/Input'; import Icon from '../icons/Icon'; import Button, {ButtonTypeType} from '../buttons/Button'; export type SearchPropsType = { inputClassName?: string; withRoundButton?: boolean; buttonType?: ButtonTypeType; } & Omit< React.AllHTMLAttributes, 'inputClassName' | 'withRoundButton' | 'size' > & InputPropsType; // TODO: make back to spread (...InputModule.InputPropsType) after flow bump const Search = ({ /** * Additional class names */ className, /** * Optional boolean for full width search * @example */ fullWidth, /** * There are two sizes options for most of the form elements * @example * @see size="normal" https://styleguide.brainly.com/latest/docs/interactive.html?size="normal"#search * @see size="large" https://styleguide.brainly.com/latest/docs/interactive.html?size="large"#search */ size, /** * Optional boolean for round button in search * @example */ withRoundButton = false, /** * Optional classname for input in search * @example */ inputClassName, /** * The default behavior of the button. * @example */ buttonType, /** * Additional classname for input in search, like color, which is pass directly to input * @example */ ...additionalProps }: SearchPropsType) => { const baseClassName = 'sg-search'; const searchClassName = cx( baseClassName, { [`sg-search--${String(size)}`]: size, 'sg-search--full-width': fullWidth, }, className ); return (
); }; export default Search; export {SIZE, COLOR};