AddonRowActions.jsx
1 week ago
AddonsList.jsx
1 week ago
AllAccessAddonsSummary.jsx
1 week ago
AutoUpdateModal.jsx
1 week ago
DownloadActivateButton.jsx
1 week ago
EmptyState.jsx
1 week ago
FeatureList.jsx
1 week ago
LicenseField.jsx
1 week ago
LicenseItem.jsx
1 week ago
LicenseNotices.jsx
1 week ago
LicenseStatus.jsx
1 week ago
Loader.jsx
1 week ago
PricingModal.jsx
1 week ago
PricingTable.jsx
1 week ago
PricingTableItem.jsx
1 week ago
SitesModal.jsx
1 week ago
LicenseStatus.jsx
44 lines
| 1 | /** |
| 2 | * WordPress Dependencies |
| 3 | */ |
| 4 | import { __ } from '@wordpress/i18n'; |
| 5 | |
| 6 | /** |
| 7 | * Internal Dependencies |
| 8 | */ |
| 9 | import { clsx } from '@admin/utils'; |
| 10 | |
| 11 | export function LicenseStatus( { status, showRenew = false, onRenew } ) { |
| 12 | const isActiveStatus = status === 'active' || status === 'valid'; |
| 13 | const isInactiveStatus = status === 'inactive'; |
| 14 | const isExpiredStatus = status === 'expired'; |
| 15 | |
| 16 | return ( |
| 17 | <span className="inline-flex items-center gap-2"> |
| 18 | <span |
| 19 | className={ clsx( |
| 20 | 'inline-block h-2 w-2 shrink-0 rounded-full', |
| 21 | isActiveStatus && 'bg-green-500', |
| 22 | isExpiredStatus && 'bg-red-500', |
| 23 | isInactiveStatus && 'bg-orange-500', |
| 24 | ! isActiveStatus && |
| 25 | ! isExpiredStatus && |
| 26 | ! isInactiveStatus && |
| 27 | 'bg-orange-500' |
| 28 | ) } |
| 29 | aria-hidden |
| 30 | /> |
| 31 | <span className="capitalize">{ status }</span> |
| 32 | { showRenew && onRenew ? ( |
| 33 | <button |
| 34 | type="button" |
| 35 | className="button button-link underline! underline-offset-3" |
| 36 | onClick={ onRenew } |
| 37 | > |
| 38 | { __( 'Renew', 'advanced-ads' ) } |
| 39 | </button> |
| 40 | ) : null } |
| 41 | </span> |
| 42 | ); |
| 43 | } |
| 44 |