diff --git a/projects/plugins/boost/app/assets/src/js/features/page-cache/meta/meta.module.scss b/projects/plugins/boost/app/assets/src/js/features/page-cache/meta/meta.module.scss index 5f4a0aef0d735..19c78fbced9d8 100644 --- a/projects/plugins/boost/app/assets/src/js/features/page-cache/meta/meta.module.scss +++ b/projects/plugins/boost/app/assets/src/js/features/page-cache/meta/meta.module.scss @@ -91,3 +91,24 @@ } } } + +.example-wrapper { + position: relative; + display: inline; + + .example-button { + position: relative; + z-index: 10; + } + + .tooltip-wrapper { + position: absolute; + top: 0; + left: -10px; + z-index: 9; + + .tooltip :global(.icon-tooltip-container .components-popover__content) { + width: 150px; + } + } +} diff --git a/projects/plugins/boost/app/assets/src/js/features/page-cache/meta/meta.tsx b/projects/plugins/boost/app/assets/src/js/features/page-cache/meta/meta.tsx index fd77c8c34b16a..1d88db1075952 100644 --- a/projects/plugins/boost/app/assets/src/js/features/page-cache/meta/meta.tsx +++ b/projects/plugins/boost/app/assets/src/js/features/page-cache/meta/meta.tsx @@ -1,4 +1,4 @@ -import { Button, Notice } from '@automattic/jetpack-components'; +import { Button, IconTooltip, Notice } from '@automattic/jetpack-components'; import { createInterpolateElement } from '@wordpress/element'; import { __, _n, sprintf } from '@wordpress/i18n'; import ChevronDown from '$svg/chevron-down'; @@ -179,7 +179,7 @@ const BypassPatterns = ( {

{ __( 'Error: Invalid format', 'jetpack-boost' ) }

-

+

{ __( 'Use (.*) to address multiple URLs under a given path. Be sure each URL path is in its own line.', 'jetpack-boost' @@ -188,13 +188,12 @@ const BypassPatterns = ( { { createInterpolateElement( __( 'See an example or learn more.', 'jetpack-boost' ), { - // eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid - help: , + help: , // children are passed after the interpolation. // eslint-disable-next-line jsx-a11y/anchor-has-content link: , } ) } -

+
{ showNotice && ( ); }; + +type BypassPatternsExampleProps = { + children?: React.ReactNode; +}; + +const BypassPatternsExample = ( { children }: BypassPatternsExampleProps ) => { + const [ show, setShow ] = useState( false ); + + return ( +
+ { /* eslint-disable-next-line jsx-a11y/anchor-is-valid */ } + { + e.preventDefault(); + setShow( ! show ); + } } + > + { children } + +
+ + { __( 'Example:', 'jetpack-boost' ) } +
+ checkout +
+ gallery/.* +
+ specific-page +
+
+
+ ); +}; diff --git a/projects/plugins/boost/changelog/update-exceptions-ui b/projects/plugins/boost/changelog/update-exceptions-ui new file mode 100644 index 0000000000000..f6bfd5a8ed355 --- /dev/null +++ b/projects/plugins/boost/changelog/update-exceptions-ui @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Update cache exceptions UI to include an example tooltip. + +