Add isBusy state for template card
[MAILPOET-4676]
This commit is contained in:
@ -54,7 +54,7 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:disabled {
|
&:disabled:not(.mailpoet-templates-card-is-busy) {
|
||||||
filter: grayscale(1);
|
filter: grayscale(1);
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import classNames from 'classnames';
|
||||||
import { EventHandler, MouseEvent } from 'react';
|
import { EventHandler, MouseEvent } from 'react';
|
||||||
import { Card, CardBody, CardHeader } from '@wordpress/components';
|
import { Card, CardBody, CardHeader } from '@wordpress/components';
|
||||||
import { Tag } from '@woocommerce/components';
|
import { Tag } from '@woocommerce/components';
|
||||||
@ -10,6 +11,7 @@ type Props = {
|
|||||||
badge?: 'essential' | 'coming-soon' | 'premium';
|
badge?: 'essential' | 'coming-soon' | 'premium';
|
||||||
onClick?: EventHandler<MouseEvent<HTMLButtonElement>>;
|
onClick?: EventHandler<MouseEvent<HTMLButtonElement>>;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
|
isBusy?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function Item({
|
export function Item({
|
||||||
@ -19,14 +21,17 @@ export function Item({
|
|||||||
badge,
|
badge,
|
||||||
onClick,
|
onClick,
|
||||||
disabled = false,
|
disabled = false,
|
||||||
|
isBusy = false,
|
||||||
}: Props): JSX.Element {
|
}: Props): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
as="button"
|
as="button"
|
||||||
className="mailpoet-templates-card"
|
className={classNames('mailpoet-templates-card', {
|
||||||
|
'mailpoet-templates-card-is-busy': isBusy,
|
||||||
|
})}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
disabled={disabled}
|
disabled={disabled || isBusy}
|
||||||
aria-disabled={disabled}
|
aria-disabled={disabled || isBusy}
|
||||||
>
|
>
|
||||||
<CardHeader className="mailpoet-templates-card-header">
|
<CardHeader className="mailpoet-templates-card-header">
|
||||||
{badge && <ItemBadge type={badge} />}
|
{badge && <ItemBadge type={badge} />}
|
||||||
|
Reference in New Issue
Block a user