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,7 +7,7 @@ import css from './modal.css'; export type ModalSize = 'small' | 'large' | 'fit-content'; -type Props = { +export type ModalProps = { +name: string, +icon?: Icon, +onClose: () => void, @@ -15,7 +15,7 @@ +size?: ModalSize, }; -function Modal(props: Props): React.Node { +function Modal(props: ModalProps): React.Node { const { size = 'small', children, onClose, name, icon } = props; const overlayRef = React.useRef(); 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,26 +3,25 @@ import * as React from 'react'; import Search from '../components/search.react'; -import Modal from './modal.react'; +import Modal, { type ModalProps } from './modal.react'; import css from './search-modal.css'; type Props = { - +name: string, - +searchPlaceholder: string, - +onClose: () => void, + ...ModalProps, +children: (searchText: string) => React.Node, + +searchPlaceholder: string, }; function SearchModal(props: Props): React.Node { const [searchText, setSearchText] = React.useState(''); - const { name, searchPlaceholder, onClose, children } = props; + const { children, searchPlaceholder, ...modalProps } = props; const child = React.useMemo(() => children(searchText), [ children, searchText, ]); return ( - +