Skip to content

Commit bafd731

Browse files
committed
add presets, proControl, filters for premium
1 parent abc7556 commit bafd731

File tree

19 files changed

+369
-300
lines changed

19 files changed

+369
-300
lines changed

src/components/color-palette-control/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ const ColorPaletteControl = memo( props => {
169169

170170
const toggleSettings = {
171171
colorValue: value,
172-
label: colorLabel,
172+
label: props.colorLabel || colorLabel,
173173
}
174174

175175
const colorPalette = (
@@ -218,6 +218,7 @@ ColorPaletteControl.defaultProps = {
218218
attribute: '',
219219

220220
value: undefined,
221+
colorLabel: undefined,
221222
onChange: undefined,
222223
preOnChange: PASSTHRUOP,
223224
isExpanded: false,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.stk-preset-color-schemes__preset-wrapper {
2+
border: 1px solid #e0e0e0;
3+
display: grid;
4+
gap: 4px;
5+
grid-template-columns: repeat(2, 1fr);
6+
margin-bottom: 16px;
7+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { Button } from '@wordpress/components'
2+
3+
export const DEFAULT_COLOR_SCHEME_COLORS = {
4+
backgroundColor: { desktop: 'var(--stk-container-background-color, #fff)' },
5+
headingColor: { desktop: '' },
6+
textColor: { desktop: '' },
7+
linkColor: { desktop: '' },
8+
accentColor: { desktop: 'var(--stk-accent-color, #008de4)' },
9+
buttonColor: { desktop: 'var(--stk-button-background-color, #008de4)' },
10+
buttonTextColor: { desktop: 'var(--stk-button-text-color, #fff)' },
11+
buttonOutlineColor: { desktop: 'var(--stk-button-background-color, #008de4)' },
12+
}
13+
14+
export const DEFAULT_BACKGROUND_COLOR_SCHEME_COLORS = {
15+
...DEFAULT_COLOR_SCHEME_COLORS,
16+
backgroundColor: { desktop: 'var(--stk-block-background-color, #fff)' },
17+
}
18+
19+
const NOOP = () => {}
20+
21+
const ColorSchemePreview = ( { colors, onClick = NOOP } ) => {
22+
const TagName = onClick === NOOP ? 'div' : Button
23+
const additionalProps = onClick === NOOP ? {} : { onClick }
24+
return (
25+
<TagName
26+
className="stk-global-color-scheme__preview__background"
27+
style={ { backgroundColor: colors?.backgroundColor } }
28+
{ ...additionalProps }
29+
>
30+
<div className="stk-global-color-scheme__preview__typography">
31+
<span style={ { color: colors?.headingColor } }>A</span>
32+
<span style={ { color: colors?.textColor } }>a</span>
33+
</div>
34+
<div>
35+
<div
36+
className="stk-global-color-scheme__preview__button"
37+
style={ { backgroundColor: colors?.buttonColor } }
38+
/>
39+
<div
40+
className="stk-global-color-scheme__preview__button"
41+
style={ {
42+
borderStyle: 'solid',
43+
borderWidth: '1px',
44+
borderColor: colors?.buttonOutlineColor,
45+
} }
46+
/>
47+
</div>
48+
</TagName>
49+
)
50+
}
51+
52+
export default ColorSchemePreview

src/components/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,9 @@ export { default as RichText } from './rich-text'
118118
export { default as SortablePicker } from './sortable-picker'
119119
export { default as InspectorSubHeader } from './inspector-sub-header'
120120
export { default as FontPairPicker } from './font-pair-picker'
121+
export { SectionSettings } from './section-settings'
122+
export {
123+
default as ColorSchemePreview,
124+
DEFAULT_COLOR_SCHEME_COLORS,
125+
DEFAULT_BACKGROUND_COLOR_SCHEME_COLORS,
126+
} from './color-scheme-preview'

src/components/pro-control/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ const LABELS = {
124124
<li>{ __( 'Manage your custom Font Pairs', i18n ) }</li>
125125
</ul>,
126126
},
127+
'color-schemes': {
128+
title: __( 'Add Your Own Color Schemes', i18n ),
129+
description: <ul>
130+
<li>{ __( 'Add your own custom Color Schemes', i18n ) }</li>
131+
<li>{ __( 'Manage your Block\'s Default Color Schemes', i18n ) }</li>
132+
</ul>,
133+
},
127134
}
128135

129136
const ProControl = props => {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export const SectionSettings = props => {
2+
return <>
3+
<div className="ugb-global-settings__section-settings">
4+
<p className="ugb-global-settings__section-title">{ props.title }</p>
5+
{ props.description && <p>{ props.description }</p> }
6+
{ props.children }
7+
</div>
8+
</>
9+
}

src/components/sortable-picker/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const SortablePicker = props => {
110110
sortable={ false }
111111
editableName={ editableName }
112112
className={ props.buttonClassName }
113-
buttonOnClick={ props.buttonOnClick }
113+
onItemClick={ props.onItemClick }
114114
/> )
115115
) }
116116
{ items?.map( ( item, i ) => (
@@ -125,7 +125,7 @@ const SortablePicker = props => {
125125
updateOnBlur={ props.updateOnBlur }
126126
editableName={ editableName }
127127
className={ props.buttonClassName }
128-
buttonOnClick={ props.buttonOnClick }
128+
onItemClick={ props.onItemClick }
129129
/> ) ) }
130130
</SortableContainer>
131131
</div>
@@ -192,8 +192,8 @@ const LabeledItemIndicator = props => {
192192
<Button
193193
className={ buttonClassNames }
194194
onClick={ () => {
195-
if ( props.buttonOnClick ) {
196-
props.buttonOnClick( item )
195+
if ( props.onItemClick ) {
196+
props.onItemClick( item )
197197
return
198198
}
199199

src/plugins/global-settings/buttons-and-icons/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ import {
1414
ShadowControl,
1515
Button,
1616
HelpTooltip,
17+
SectionSettings,
1718
} from '~stackable/components'
1819
import {
1920
useBlockLayoutEditorLoader,
2021
useBlockLayoutInspectorUtils,
21-
SectionSettings,
2222
STATES,
2323
} from '../utils'
2424
import { BORDER_CONTROLS } from '~stackable/block-components'

0 commit comments

Comments
 (0)