From 032f7a8f58764a0b36251dd534159f304a9e64c5 Mon Sep 17 00:00:00 2001 From: Nikita Date: Tue, 8 Oct 2024 14:39:39 +0300 Subject: [PATCH] improve repeater control Add Row and Toggle rows buttons style --- assets/editor/index.scss | 37 +++++++++++++++++++---- controls/repeater/repeater-control.js | 43 ++++++++++++++++++++------- 2 files changed, 64 insertions(+), 16 deletions(-) diff --git a/assets/editor/index.scss b/assets/editor/index.scss index 1e7776dd..7c586044 100644 --- a/assets/editor/index.scss +++ b/assets/editor/index.scss @@ -626,7 +626,6 @@ cursor: pointer; background: none; border: none; - border-radius: 50%; opacity: 0; > svg { @@ -641,7 +640,11 @@ } &:hover .lzb-gutenberg-repeater-btn-duplicate, - &:hover .lzb-gutenberg-repeater-btn-remove { + .lzb-gutenberg-repeater-btn-duplicate:hover, + .lzb-gutenberg-repeater-btn-duplicate:focus, + &:hover .lzb-gutenberg-repeater-btn-remove, + .lzb-gutenberg-repeater-btn-remove:hover, + .lzb-gutenberg-repeater-btn-remove:focus { opacity: 1; } @@ -709,16 +712,40 @@ } .lzb-gutenberg-repeater-items { - margin-bottom: 15px; + margin-bottom: 3px; } .lzb-gutenberg-repeater-options { display: flex; flex-direction: row; justify-content: space-between; + text-align: center; - .components-toggle-control .components-form-toggle { - margin-right: 0; + .components-button { + &:not(.is-primary):not(:hover,:focus) { + --wp-components-color-accent: #949494; + + color: #292929; + } + + justify-content: center; + text-transform: uppercase; + font-size: 12px; + font-weight: 500; + } + + .lzb-gutenberg-repeater-options-add { + flex: 1; + } + .lzb-gutenberg-repeater-options-expand { + padding-left: 6px; + padding-right: 6px; + + svg { + fill: none; + width: 1.5em; + height: 1.5em; + } } } diff --git a/controls/repeater/repeater-control.js b/controls/repeater/repeater-control.js index 7e25fd94..a5284983 100644 --- a/controls/repeater/repeater-control.js +++ b/controls/repeater/repeater-control.js @@ -20,7 +20,7 @@ import { CSS } from '@dnd-kit/utilities'; */ import { __ } from '@wordpress/i18n'; import { useEffect, useState } from '@wordpress/element'; -import { Button, ToggleControl } from '@wordpress/components'; +import { Button, ButtonGroup, Tooltip } from '@wordpress/components'; import { withInstanceId } from '@wordpress/compose'; /** @@ -329,10 +329,11 @@ function RepeaterControl(props) { ) : null} -
+ + ) : ( '' )} -
+ ); }