Allow using woocommerce icons for product details section description (#45348)
* Allow using woocommerce icons for product details section description and add gift icon * Use core components for SVG
This commit is contained in:
parent
ca2c12e667
commit
1ad84aa6fe
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: add
|
||||
|
||||
Allow using woocommerce icons for product details section description and add gift icon
|
|
@ -42,6 +42,7 @@ import type {
|
|||
ProductTemplate,
|
||||
} from '../../../types';
|
||||
import { ProductDetailsSectionDescriptionBlockAttributes } from './types';
|
||||
import * as wooIcons from '../../../icons';
|
||||
|
||||
export function ProductDetailsSectionDescriptionBlockEdit( {
|
||||
attributes,
|
||||
|
@ -176,9 +177,9 @@ export function ProductDetailsSectionDescriptionBlockEdit( {
|
|||
if ( /^https?:\/\//.test( iconId ) ) {
|
||||
icon = <img src={ iconId } alt={ alt } />;
|
||||
} else {
|
||||
if ( ! ( iconId in icons ) ) return undefined;
|
||||
if ( ! ( iconId in icons || iconId in wooIcons ) ) return undefined;
|
||||
|
||||
icon = icons[ iconId as never ];
|
||||
icon = icons[ iconId as never ] || wooIcons[ iconId as never ];
|
||||
}
|
||||
|
||||
return <Icon icon={ icon } size={ 24 } />;
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { createElement } from '@wordpress/element';
|
||||
import { SVG, Path, Rect } from '@wordpress/components';
|
||||
|
||||
const gift = (
|
||||
<SVG viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<Rect
|
||||
x="-0.75"
|
||||
y="-0.75"
|
||||
fill="none"
|
||||
width="9.5"
|
||||
height="14.5"
|
||||
transform="matrix(3.97376e-08 -1 -1 -4.80825e-08 18.5 18.5)"
|
||||
stroke="#1E1E1E"
|
||||
strokeWidth="1.5"
|
||||
/>
|
||||
<Path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M13 19L13 9L11.5 9L11.5 19L13 19Z"
|
||||
/>
|
||||
<Path
|
||||
d="M16.5 6.5C16.5 7.4665 15.7165 8.25 14.75 8.25H13V6.5C13 5.5335 13.7835 4.75 14.75 4.75C15.7165 4.75 16.5 5.5335 16.5 6.5Z"
|
||||
stroke="#1E1E1E"
|
||||
fill="none"
|
||||
strokeWidth="1.5"
|
||||
/>
|
||||
<Path
|
||||
d="M8 6.5C8 7.4665 8.7835 8.25 9.75 8.25H11.5V6.5C11.5 5.5335 10.7165 4.75 9.75 4.75C8.7835 4.75 8 5.5335 8 6.5Z"
|
||||
stroke="#1E1E1E"
|
||||
fill="none"
|
||||
strokeWidth="1.5"
|
||||
/>
|
||||
</SVG>
|
||||
);
|
||||
|
||||
export default gift;
|
|
@ -0,0 +1,3 @@
|
|||
export { default as hidden } from './hidden-icon';
|
||||
export { default as gift } from './gift';
|
||||
export { default as seen } from './seen-icon';
|
Loading…
Reference in New Issue