@wq/material-web
Version:
Web bindings for @wq/material
37 lines (36 loc) • 1.07 kB
JavaScript
import React from "react";
import { useComponents, useMessages } from "@wq/react";
import PropTypes from "prop-types";
export default function DeleteForm({ action }) {
const { Form, SubmitButton, View, HorizontalView } = useComponents(),
{ CONFIRM_DELETE } = useMessages();
function confirmSubmit() {
return window.confirm(CONFIRM_DELETE);
}
return /*#__PURE__*/ React.createElement(
Form,
{
action: action,
method: "DELETE",
backgroundSync: false,
onSubmit: confirmSubmit,
},
/*#__PURE__*/ React.createElement(
HorizontalView,
null,
/*#__PURE__*/ React.createElement(View, null),
/*#__PURE__*/ React.createElement(
SubmitButton,
{
icon: "delete",
variant: "text",
color: "secondary",
},
"Delete"
)
)
);
}
DeleteForm.propTypes = {
action: PropTypes.string,
};