This reverts commit d6d94ae622.
This commit is contained in:
Alex Florisca 2022-09-21 15:20:00 +01:00 committed by GitHub
parent 77a2255978
commit 79b1d4a38a
2 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,7 @@
/**
* External dependencies
*/
import { kebabCase } from 'lodash';
import { decodeEntities } from '@wordpress/html-entities';
import type { ProductResponseItemData } from '@woocommerce/type-defs/product-response';
@ -31,10 +32,15 @@ const ProductDetails = ( {
{ details.map( ( detail ) => {
// Support both `key` and `name` props
const name = detail?.key || detail.name || '';
const className = name
? `wc-block-components-product-details__${ kebabCase(
name
) }`
: '';
return (
<li
key={ name + ( detail.display || detail.value ) }
className="wc-block-components-product-details__item"
className={ className }
>
{ name && (
<>

View File

@ -5,7 +5,7 @@ exports[`ProductDetails should not render hidden details 1`] = `
className="wc-block-components-product-details"
>
<li
className="wc-block-components-product-details__item"
className="wc-block-components-product-details__lorem"
>
<span
className="wc-block-components-product-details__name"
@ -32,7 +32,7 @@ exports[`ProductDetails should render details 1`] = `
className="wc-block-components-product-details"
>
<li
className="wc-block-components-product-details__item"
className="wc-block-components-product-details__lorem"
>
<span
className="wc-block-components-product-details__name"
@ -48,7 +48,7 @@ exports[`ProductDetails should render details 1`] = `
</span>
</li>
<li
className="wc-block-components-product-details__item"
className="wc-block-components-product-details__lorem"
>
<span
className="wc-block-components-product-details__name"
@ -64,7 +64,7 @@ exports[`ProductDetails should render details 1`] = `
</span>
</li>
<li
className="wc-block-components-product-details__item"
className=""
>
<span