2020-02-19 17:14:41 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __, sprintf } from '@wordpress/i18n';
|
|
|
|
|
2021-05-10 09:03:30 +00:00
|
|
|
interface ShippingLocationProps {
|
2023-03-22 07:15:13 +00:00
|
|
|
formattedLocation: string | null;
|
2021-05-10 09:03:30 +00:00
|
|
|
}
|
|
|
|
|
2023-03-22 07:15:13 +00:00
|
|
|
// Shows a formatted shipping location.
|
2021-05-10 09:03:30 +00:00
|
|
|
const ShippingLocation = ( {
|
2023-03-22 07:15:13 +00:00
|
|
|
formattedLocation,
|
2021-05-10 09:03:30 +00:00
|
|
|
}: ShippingLocationProps ): JSX.Element | null => {
|
2021-03-16 09:57:04 +00:00
|
|
|
if ( ! formattedLocation ) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2020-02-19 17:14:41 +00:00
|
|
|
return (
|
2021-03-16 09:57:04 +00:00
|
|
|
<span className="wc-block-components-shipping-address">
|
|
|
|
{ sprintf(
|
|
|
|
/* translators: %s location. */
|
|
|
|
__( 'Shipping to %s', 'woo-gutenberg-products-block' ),
|
|
|
|
formattedLocation
|
|
|
|
) + ' ' }
|
|
|
|
</span>
|
2020-02-19 17:14:41 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ShippingLocation;
|