diff --git a/web/modals/modal.react.js b/web/modals/modal.react.js --- a/web/modals/modal.react.js +++ b/web/modals/modal.react.js @@ -7,16 +7,21 @@ import css from './modal.css'; export type ModalSize = 'small' | 'large' | 'fit-content'; -type Props = { + +export type ModalOverridableProps = { +name: string, +icon?: Icon, +onClose: () => void, +withCloseButton?: boolean, - +children?: React.Node, +size?: ModalSize, }; -function Modal(props: Props): React.Node { +type ModalProps = { + ...ModalOverridableProps, + +children?: React.Node, +}; + +function Modal(props: ModalProps): React.Node { const { size = 'small', children, diff --git a/web/modals/search-modal.react.js b/web/modals/search-modal.react.js --- a/web/modals/search-modal.react.js +++ b/web/modals/search-modal.react.js @@ -3,27 +3,25 @@ import * as React from 'react'; import Search from '../components/search.react'; -import Modal, { type ModalSize } from './modal.react'; +import Modal, { type ModalOverridableProps } from './modal.react'; import css from './search-modal.css'; type Props = { - +name: string, - +searchPlaceholder: string, - +size?: ModalSize, - +onClose: () => void, + ...ModalOverridableProps, +children: (searchText: string) => React.Node, + +searchPlaceholder: string, }; function SearchModal(props: Props): React.Node { const [searchText, setSearchText] = React.useState(''); - const { name, searchPlaceholder, size, onClose, children } = props; + const { children, searchPlaceholder, ...modalProps } = props; const child = React.useMemo(() => children(searchText), [ children, searchText, ]); return ( - +