saleor-dashboard/src/webhooks/components/WebhookStatus/WebhookStatus.tsx

43 lines
1.2 KiB
TypeScript
Raw Normal View History

import { Card, CardContent, Typography } from "@material-ui/core";
2019-10-09 06:01:52 +00:00
import CardTitle from "@saleor/components/CardTitle";
import ControlledCheckbox from "@saleor/components/ControlledCheckbox";
import { ChangeEvent } from "@saleor/hooks/useForm";
2019-10-09 06:01:52 +00:00
import React from "react";
import { useIntl } from "react-intl";
import { FormData } from "../WebhookDetailsPage";
import { messages } from "./messages";
2019-10-09 06:01:52 +00:00
interface WebhookStatusProps {
data: boolean;
2019-10-09 06:01:52 +00:00
disabled: boolean;
onChange: (event: ChangeEvent, cb?: () => void) => void;
2019-10-09 06:01:52 +00:00
}
2019-10-11 13:35:33 +00:00
const WebhookStatus: React.FC<WebhookStatusProps> = ({
2019-10-09 06:01:52 +00:00
data,
disabled,
2019-10-09 20:50:03 +00:00
onChange
2019-10-09 06:01:52 +00:00
}) => {
const intl = useIntl();
return (
<Card>
<CardTitle title={intl.formatMessage(messages.webhookStatus)} />
2019-10-09 20:50:03 +00:00
<CardContent>
<Typography variant="body1">
{intl.formatMessage(messages.webhookActiveDescription)}
2019-10-09 20:50:03 +00:00
</Typography>
<ControlledCheckbox
name={"isActive" as keyof FormData}
label={intl.formatMessage(messages.webhookActive)}
checked={data}
2019-10-09 20:50:03 +00:00
onChange={onChange}
disabled={disabled}
/>
</CardContent>
2019-10-09 06:01:52 +00:00
</Card>
);
};
WebhookStatus.displayName = "WebhookStatus";
export default WebhookStatus;