Files
redash/client/app/components/groups/CreateGroupDialog.tsx
Elad Ossadon c426379bef [ts-migrate][client] Run TS Migrate
Co-authored-by: ts-migrate <>
2020-12-16 08:24:26 -08:00

44 lines
1.2 KiB
TypeScript

import React from "react";
import Modal from "antd/lib/modal";
import Input from "antd/lib/input";
// @ts-expect-error ts-migrate(6133) FIXME: 'DialogPropType' is declared but its value is neve... Remove this comment to see the full error message
import { wrap as wrapDialog, DialogPropType } from "@/components/DialogWrapper";
type Props = {
// @ts-expect-error ts-migrate(2749) FIXME: 'DialogPropType' refers to a value, but is being u... Remove this comment to see the full error message
dialog: DialogPropType;
};
type State = any;
class CreateGroupDialog extends React.Component<Props, State> {
state = {
name: "",
};
save = () => {
this.props.dialog.close({
name: this.state.name,
});
};
render() {
const { dialog } = this.props;
return (
<Modal {...dialog.props} title="Create a New Group" okText="Create" onOk={() => this.save()}>
<Input
className="form-control"
defaultValue={this.state.name}
onChange={event => this.setState({ name: event.target.value })}
onPressEnter={() => this.save()}
placeholder="Group Name"
autoFocus
/>
</Modal>
);
}
}
export default wrapDialog(CreateGroupDialog);