import { createRef, Component, ComponentChildren } from "preact"; import { Modal } from "bootstrap"; import './bootstrap.scss'; import './style.scss'; interface ModalProps { children: ComponentChildren; buttons?: ComponentChildren; title: string; dismissHandler?: (hideModal?: () => void) => void; } export class MyModal extends Component { ref = createRef(); constructor() { super(); } componentDidMount() { Modal.getOrCreateInstance(this.ref.current!).show(); this.ref.current?.addEventListener('hide.bs.modal', () => { this.props.dismissHandler && this.props.dismissHandler(); }); } componentWillUnmount() { this.hide() } hide(): void { Modal.getOrCreateInstance(this.ref.current!).hide(); } render() { return ; } } interface ButtonProps { priority: "primary" | "secondary" | "danger" clickHandler?: () => void children: ComponentChildren disabled?: boolean; } export function Button(props:ButtonProps) { let classes: string = "btn btn-" + props.priority return }