Skip to content

Commit 6e3a005

Browse files
committed
update popover
1 parent 357db74 commit 6e3a005

File tree

4 files changed

+31
-21
lines changed

4 files changed

+31
-21
lines changed

src/components/icon-search-popover/index.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import {
1111
PanelBody, TextControl, Spinner,
1212
} from '@wordpress/components'
1313
import { __ } from '@wordpress/i18n'
14-
import { useState, useEffect } from '@wordpress/element'
14+
import {
15+
useState, useEffect, Fragment,
16+
} from '@wordpress/element'
1517

1618
/**
1719
* External dependencies
@@ -25,7 +27,7 @@ import {
2527
import { faGetIcon, faFetchIcon } from '~stackable/util'
2628
import { FileDrop } from 'react-file-drop'
2729
import classnames from 'classnames'
28-
import { applyFilters } from '@wordpress/hooks'
30+
import { applyFilters, doAction } from '@wordpress/hooks'
2931

3032
let searchTimeout = null
3133
let tempMediaUpload = null
@@ -152,9 +154,7 @@ const IconSearchPopover = props => {
152154
setIsDropping( false )
153155
const svgString = cleanSvgString( addCustomIconClass( e.target.result ) )
154156

155-
if ( isPro && props.showPrompt ) {
156-
applyFilters( 'stackable.global-settings.inspector.icon-library.prompt', null, svgString )
157-
}
157+
doAction( 'stackable.icon-search-popover.svg-upload', svgString )
158158

159159
props.onChange( svgString )
160160
props.onClose()
@@ -173,6 +173,8 @@ const IconSearchPopover = props => {
173173
'ugb-icon--has-reset': props.allowReset,
174174
} )
175175

176+
const IconLibraryIcons = applyFilters( 'stackable.global-settings.inspector.icon-library.icons', Fragment )
177+
176178
const content = (
177179
<div className="stk-icon-search-popover-container">
178180
<FileDrop
@@ -249,9 +251,11 @@ const IconSearchPopover = props => {
249251
</div>
250252
<div className="ugb-icon-popover__iconlist">
251253
{ isBusy && <Spinner /> }
252-
{ ! isBusy && applyFilters( 'stackable.global-settings.inspector.icon-library.icons', null, {
253-
icons: results.iconLibrary, onChange: props.onChange, onClose: props.onClose,
254-
} ) }
254+
{ ! isBusy && <IconLibraryIcons
255+
icons={ results.iconLibrary }
256+
onChange={ props.onChange }
257+
onClose={ props.onClose }
258+
/> }
255259
{ ! isBusy && results.faIcons.map( ( { prefix, iconName }, i ) => {
256260
const iconValue = `${ prefix }-${ iconName }`
257261
return <button
@@ -326,7 +330,6 @@ IconSearchPopover.defaultProps = {
326330
onClose: noop,
327331
returnSVGValue: true, // If true, the value provided in onChange will be the SVG markup of the icon. If false, the value will be a prefix-iconName value.
328332
allowReset: true,
329-
showPrompt: true,
330333
__deprecatedAnchorRef: undefined,
331334
__deprecatedPosition: 'center',
332335
__deprecatedOnClickOutside: noop,

src/components/sortable-picker/index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ import {
2020
import { useState } from '@wordpress/element'
2121
import { __ } from '@wordpress/i18n'
2222

23+
const addItemPopoverProps = {
24+
placement: 'left-start',
25+
offset: 236,
26+
shift: true,
27+
}
28+
2329
const popoverProps = {
2430
placement: 'left-start',
2531
offset: 36,
@@ -59,6 +65,7 @@ const SortablePicker = props => {
5965
return (
6066
<BaseControl className={ classNames } label={ props.label }>
6167
<Dropdown
68+
popoverProps={ addItemPopoverProps }
6269
renderToggle={ ( { onToggle, isOpen } ) => (
6370
<Button
6471
className="ugb-global-settings-color-picker__add-button"
@@ -189,9 +196,7 @@ const LabeledItemIndicator = props => {
189196
)
190197
} }
191198
renderContent={ () => (
192-
<div className="stk-color-palette-control__popover-content">
193-
<ItemPicker item={ item } onChange={ onChange } />
194-
</div>
199+
<ItemPicker item={ item } onChange={ onChange } />
195200
) }
196201
/>
197202
<Button

src/plugins/global-settings/colors/color-picker.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,16 @@ const ColorPickers = props => {
135135
}
136136

137137
const ItemPicker = ( { item, onChange } ) => {
138-
return <ColorPicker
139-
onChange={ value => onChange( {
140-
...item,
141-
color: value,
142-
} ) }
143-
color={ item.color }
144-
enableAlpha={ true }
145-
/>
138+
return <div className="stk-color-palette-control__popover-content">
139+
<ColorPicker
140+
onChange={ value => onChange( {
141+
...item,
142+
color: value,
143+
} ) }
144+
color={ item.color }
145+
enableAlpha={ true }
146+
/>
147+
</div>
146148
}
147149

148150
return (
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.ugb-global-settings__inspector.components-panel {
2-
.components-panel__body-title {
2+
.components-panel__body .components-panel__body-title {
33
top: 48px;
44
}
55
}

0 commit comments

Comments
 (0)