2021-03-09 10:55:24 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import type { ReactElement } from 'react';
|
|
|
|
import type { PackageRateOption } from '@woocommerce/type-defs/shipping';
|
|
|
|
|
2020-02-14 03:43:13 +00:00
|
|
|
const OptionLayout = ( {
|
|
|
|
label,
|
|
|
|
secondaryLabel,
|
|
|
|
description,
|
|
|
|
secondaryDescription,
|
|
|
|
id,
|
2021-03-09 10:55:24 +00:00
|
|
|
}: Partial< PackageRateOption > ): ReactElement => {
|
2020-02-14 03:43:13 +00:00
|
|
|
return (
|
2020-06-17 09:53:42 +00:00
|
|
|
<div className="wc-block-components-radio-control__option-layout">
|
|
|
|
<div className="wc-block-components-radio-control__label-group">
|
2020-05-12 14:17:02 +00:00
|
|
|
{ label && (
|
|
|
|
<span
|
2021-03-09 10:55:24 +00:00
|
|
|
id={ id && `${ id }__label` }
|
2020-06-17 09:53:42 +00:00
|
|
|
className="wc-block-components-radio-control__label"
|
2020-05-12 14:17:02 +00:00
|
|
|
>
|
|
|
|
{ label }
|
|
|
|
</span>
|
|
|
|
) }
|
|
|
|
{ secondaryLabel && (
|
|
|
|
<span
|
2021-03-09 10:55:24 +00:00
|
|
|
id={ id && `${ id }__secondary-label` }
|
2020-06-17 09:53:42 +00:00
|
|
|
className="wc-block-components-radio-control__secondary-label"
|
2020-05-12 14:17:02 +00:00
|
|
|
>
|
|
|
|
{ secondaryLabel }
|
|
|
|
</span>
|
|
|
|
) }
|
|
|
|
</div>
|
2020-06-17 09:53:42 +00:00
|
|
|
<div className="wc-block-components-radio-control__description-group">
|
2020-05-12 14:17:02 +00:00
|
|
|
{ description && (
|
|
|
|
<span
|
2021-03-09 10:55:24 +00:00
|
|
|
id={ id && `${ id }__description` }
|
2020-06-17 09:53:42 +00:00
|
|
|
className="wc-block-components-radio-control__description"
|
2020-05-12 14:17:02 +00:00
|
|
|
>
|
|
|
|
{ description }
|
|
|
|
</span>
|
|
|
|
) }
|
|
|
|
{ secondaryDescription && (
|
|
|
|
<span
|
2021-03-09 10:55:24 +00:00
|
|
|
id={ id && `${ id }__secondary-description` }
|
2020-06-17 09:53:42 +00:00
|
|
|
className="wc-block-components-radio-control__secondary-description"
|
2020-05-12 14:17:02 +00:00
|
|
|
>
|
|
|
|
{ secondaryDescription }
|
|
|
|
</span>
|
|
|
|
) }
|
|
|
|
</div>
|
2020-02-14 03:43:13 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default OptionLayout;
|