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

54 lines
1.5 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 "../WebhooksDetailsPage";
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({
defaultMessage: "Webhook Status",
description: "section header"
})}
/>
2019-10-09 20:50:03 +00:00
<CardContent>
<Typography>
{intl.formatMessage({
defaultMessage:
"If you want to disable this webhook please uncheck the box below.",
description: "webhook active"
})}
</Typography>
<ControlledCheckbox
name={"isActive" as keyof FormData}
label={intl.formatMessage({
defaultMessage: "Webhook is active",
description: "webhooks active"
})}
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;