diff --git a/plugins/woocommerce-blocks/assets/js/editor-components/incompatible-extension-notice/editor.scss b/plugins/woocommerce-blocks/assets/js/editor-components/incompatible-extension-notice/editor.scss index 1b181517407..a61b1b10754 100644 --- a/plugins/woocommerce-blocks/assets/js/editor-components/incompatible-extension-notice/editor.scss +++ b/plugins/woocommerce-blocks/assets/js/editor-components/incompatible-extension-notice/editor.scss @@ -14,6 +14,44 @@ .wc-blocks-incompatible-extensions-notice__content { display: flex; + details { + margin: 0; + + &[open] { + margin: 0 0 $gap; + + summary { + svg { + transform: rotate(180deg); + } + } + } + + summary { + display: block; // Remove marker for non Webkit-based browsers. + cursor: pointer; + text-decoration: underline; + margin: 0 0 $gap; + + span { + color: $gray-700; + text-decoration: underline; // Ensure text-decoration works in Safari. + } + + &::-webkit-details-marker { + display: none; // Remove marker for Webkit-based browsers. + } + + svg { + width: 24px; + height: 24px; + position: relative; + top: 6px; + fill: $gray-700; + } + } + } + .wc-blocks-incompatible-extensions-notice__warning-icon { width: 24px; height: 24px; @@ -22,7 +60,7 @@ } } ul { - margin: 0 0 1em 1.2em; + margin: 0 0 0 1.2em; padding: 0; list-style: disc outside; } diff --git a/plugins/woocommerce-blocks/assets/js/editor-components/incompatible-extension-notice/index.tsx b/plugins/woocommerce-blocks/assets/js/editor-components/incompatible-extension-notice/index.tsx index d7370f93508..98d0e3e958d 100644 --- a/plugins/woocommerce-blocks/assets/js/editor-components/incompatible-extension-notice/index.tsx +++ b/plugins/woocommerce-blocks/assets/js/editor-components/incompatible-extension-notice/index.tsx @@ -1,7 +1,7 @@ /** * External dependencies */ -import { __, sprintf } from '@wordpress/i18n'; +import { __, _n, sprintf } from '@wordpress/i18n'; import { Notice, ExternalLink, @@ -15,7 +15,7 @@ import { useState, } from '@wordpress/element'; import { Alert } from '@woocommerce/icons'; -import { Icon } from '@wordpress/icons'; +import { Icon, chevronDown } from '@wordpress/icons'; import { useDispatch, useSelect } from '@wordpress/data'; import { createBlock, BlockInstance } from '@wordpress/blocks'; import { store as noticesStore } from '@wordpress/notices'; @@ -54,8 +54,8 @@ export function IncompatibleExtensionsNotice( { const [ isVisible, dismissNotice, - incompatiblePaymentMethods, - numberOfIncompatiblePaymentMethods, + incompatibleExtensions, + incompatibleExtensionsCount, ] = useCombinedIncompatibilityNotice( block ); const [ isOpen, setOpen ] = useState( false ); const openModal = () => setOpen( true ); @@ -95,7 +95,7 @@ export function IncompatibleExtensionsNotice( { const noticeContent = ( <> - { numberOfIncompatiblePaymentMethods > 1 + { incompatibleExtensionsCount > 1 ? createInterpolateElement( __( 'Some active extensions do not yet support this block. This may impact the shopper experience. Learn more', @@ -114,7 +114,7 @@ export function IncompatibleExtensionsNotice( { '%s does not yet support this block. This may impact the shopper experience. Learn more', 'woo-gutenberg-products-block' ), - Object.values( incompatiblePaymentMethods )[ 0 ] + Object.values( incompatibleExtensions )[ 0 ] ), { strong: , @@ -138,6 +138,9 @@ export function IncompatibleExtensionsNotice( { } }; + const entries = Object.entries( incompatibleExtensions ); + const remainingEntries = entries.length - 2; + return (

{ noticeContent }

- { numberOfIncompatiblePaymentMethods > 1 && ( + { incompatibleExtensionsCount > 1 && (
    - { Object.entries( incompatiblePaymentMethods ).map( - ( [ id, title ] ) => ( + { entries.slice( 0, 2 ).map( ( [ id, title ] ) => ( +
  • + { title } +
  • + ) ) } +
+ ) } + + { entries.length > 2 && ( +
+ + + { sprintf( + // translators: %s is the number of incompatible extensions. + _n( + '%s more incompatibility', + '%s more incompatibilites', + remainingEntries, + 'woo-gutenberg-products-block' + ), + remainingEntries + ) } + + + +
    + { entries.slice( 2 ).map( ( [ id, title ] ) => (
  • { title }
  • - ) - ) } -
+ ) ) } + +
) } +