From bd32f0ba303f666d50c6a6b7115e8b37aecfa3a7 Mon Sep 17 00:00:00 2001 From: Vasile Chindris Date: Thu, 16 May 2024 13:35:29 +0300 Subject: [PATCH] chore(SLB-378): cta component style in the editor --- packages/drupal/gutenberg_blocks/css/edit.css | 4 ++ .../gutenberg_blocks/src/blocks/cta.tsx | 62 ++++++++++++++----- 2 files changed, 49 insertions(+), 17 deletions(-) diff --git a/packages/drupal/gutenberg_blocks/css/edit.css b/packages/drupal/gutenberg_blocks/css/edit.css index 58aefe52d..fbd577688 100644 --- a/packages/drupal/gutenberg_blocks/css/edit.css +++ b/packages/drupal/gutenberg_blocks/css/edit.css @@ -56,3 +56,7 @@ margin-right: 7px; content: url("data:image/svg+xml,%3Csvg aria-hidden='true' xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='%236B7280' %3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM6.75 9.25a.75.75 0 0 0 0 1.5h4.59l-2.1 1.95a.75.75 0 0 0 1.02 1.1l3.5-3.25a.75.75 0 0 0 0-1.1l-3.5-3.25a.75.75 0 1 0-1.02 1.1l2.1 1.95H6.75Z' clip-rule='evenodd'%3E%3C/path%3E%3C/svg%3E"); } + +.gutenberg__editor .edit-post-visual-editor__content-area a.no-underline { + text-decoration: none; +} diff --git a/packages/drupal/gutenberg_blocks/src/blocks/cta.tsx b/packages/drupal/gutenberg_blocks/src/blocks/cta.tsx index 83bfd63de..5b70375d3 100644 --- a/packages/drupal/gutenberg_blocks/src/blocks/cta.tsx +++ b/packages/drupal/gutenberg_blocks/src/blocks/cta.tsx @@ -1,3 +1,4 @@ +import clsx from 'clsx'; import { // @ts-ignore __experimentalLinkControl as LinkControl, @@ -14,6 +15,23 @@ const { t: __ } = Drupal; // @ts-ignore const { setPlainTextAttribute } = silverbackGutenbergUtils; +const ArrowRightIcon = () => ( + + + +); + // @ts-ignore registerBlockType('custom/cta', { title: 'CTA', @@ -50,23 +68,33 @@ registerBlockType('custom/cta', { edit: compose(withState({}))((props) => { return (
- { - setPlainTextAttribute(props, 'text', text); - }} - /> + + { + setPlainTextAttribute(props, 'text', text); + }} + /> + {typeof props.attributes.icon !== 'undefined' && + props.attributes.icon === 'ARROW' && } +