Skip to content

Commit 24fbf6b

Browse files
committed
fix implementation
1 parent c3cb7e2 commit 24fbf6b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/components/design-library-list/design-library-list-item.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ const DesignLibraryListItem = memo( props => {
4141
: 120
4242

4343
const [ isLoading, setIsLoading ] = useState( true )
44+
const [ selected, setSelected ] = useState( false )
4445

4546
const { hostRef, shadowRoot } = useShadowRoot( shouldRender )
4647

4748
const ref = useRef( null )
48-
const insertButtonRef = useRef( null )
4949

5050
const {
5151
blocks, enableBackground,
@@ -151,14 +151,12 @@ const DesignLibraryListItem = memo( props => {
151151
{ selectedTab === 'patterns' ? <span className="stk-block-design__selected-num">{ selectedNum === 0 ? '' : selectedNum }</span>
152152
: <div>
153153
<Button
154-
ref={ insertButtonRef }
155154
label={ __( 'Insert', i18n ) }
156155
className="ugb-modal-design-library__add-multi"
157156
disabled={ isMultiSelectBusy }
157+
data-selected={ selected }
158158
onClick={ () => {
159-
if ( insertButtonRef.current ) {
160-
insertButtonRef.current.style.opacity = 1
161-
}
159+
setSelected( true )
162160
onClickDesign()
163161
} }
164162
>

src/components/design-library-list/editor.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
@media (hover: none) {
5151
opacity: 1;
5252
}
53+
&[data-selected="true"] {
54+
opacity: 1;
55+
}
5356
}
5457
&:hover {
5558
// box-shadow: rgba(0, 0, 0, 0.25) 0px 25px 50px -12px;

0 commit comments

Comments
 (0)