import { h, Component } from 'preact'; import "./modal.scss" import Modal from './Modal'; export class InputModal extends Modal { constructor(protected title: string, private fieldname: string, private type: "text" | "password") { super(); } private static IMD = class extends Component<{ modal: InputModal }, {}> { rand: string; input: HTMLInputElement; constructor(props) { super(props); this.rand = Math.random().toString(); } componentDidMount() { this.input.focus(); } componentWillUnmount() { if (this.input) this.input.value = ""; } render() { return
{ this.input = elm; }} onKeyDown={evt => { if (evt.keyCode === 13) { this.props.modal.result(this.input.value) } }} />
{/*
*/}
} } getComponent() { return } }