Skip to content

Commit be708cf

Browse files
feat: Global Color Scheme
initial commit
1 parent ef45da5 commit be708cf

File tree

6 files changed

+50
-0
lines changed

6 files changed

+50
-0
lines changed

src/block/column/edit.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { i18n, version as VERSION } from 'stackable'
1111
import {
1212
AdvancedToggleControl,
1313
FourRangeControl,
14+
GlobalColorSchemeControl,
1415
InspectorLayoutControls,
1516
InspectorTabs,
1617
useBlockCssGenerator,
@@ -164,6 +165,7 @@ const Edit = props => {
164165
const InspectorControls = memo( props => {
165166
return (
166167
<>
168+
<GlobalColorSchemeControl />
167169
<InspectorTabs />
168170

169171
<InspectorLayoutControls>

src/block/columns/edit.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import classnames from 'classnames'
1111
import {
1212
ColumnInnerBlocks,
1313
ControlSeparator,
14+
GlobalColorSchemeControl,
1415
GroupPlaceholder,
1516
InspectorLayoutControls,
1617
InspectorTabs,
@@ -168,6 +169,7 @@ if ( userAgent && userAgent.indexOf( 'Firefox' ) !== -1 ) {
168169
const InspectorControls = memo( () => {
169170
return (
170171
<>
172+
<GlobalColorSchemeControl />
171173
<InspectorTabs />
172174

173175
<Columns.InspectorControls />
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.stk-global-color-scheme-control {
2+
padding: 8px 16px 24px !important;
3+
margin: 0 !important;
4+
> .components-base-control__field {
5+
display: flex;
6+
gap: 8px;
7+
}
8+
.stk-control-label {
9+
flex: 1 0 auto;
10+
}
11+
.stk-control-content {
12+
flex: 1 1 100%;
13+
}
14+
.stk-control-label,
15+
.components-base-control,
16+
.components-base-control__field,
17+
.components-select-control {
18+
margin: 0 !important;
19+
}
20+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import AdvancedSelectControl from '../advanced-select-control'
2+
import { i18n } from 'stackable'
3+
import { __ } from '@wordpress/i18n'
4+
import { InspectorControls } from '@wordpress/block-editor'
5+
6+
// TODO: when `add-new` is picked, disregard the value and open the global setting for global color scheme
7+
const GlobalColorSchemeControl = () => {
8+
return (
9+
<InspectorControls>
10+
<AdvancedSelectControl
11+
label={ __( 'Color Scheme', 'ultimate-addons-for-gutenberg' ) }
12+
className="stk-global-color-scheme-control"
13+
options={ [
14+
{ value: '', label: __( 'Default', i18n ) },
15+
{ value: 'alt', label: __( 'Alternative', i18n ) },
16+
{ value: 'add-new', label: __( 'Add new…', i18n ) },
17+
] }
18+
allowReset={ false }
19+
/>
20+
</InspectorControls>
21+
)
22+
}
23+
24+
export default GlobalColorSchemeControl

src/components/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export { default as ColumnInnerBlocks } from './column-inner-blocks'
106106
export { default as VariationPicker } from './variation-picker'
107107
export { default as InspectorBottomTip } from './inspector-bottom-tip'
108108
export { default as BlockWrapper } from './block-wrapper'
109+
export { default as GlobalColorSchemeControl } from './global-color-scheme-control'
109110
// TODO: clean this
110111
export {
111112
default as BlockCss, BlockCssCompiler, BlockStyleGenerator, useBlockCssGenerator,

src/styles/editor-skin.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
.ugb--has-panel-tabs .components-panel {
2626

2727
.block-editor-block-card,
28+
.stk-global-color-scheme-control,
2829
.ugb-panel-tabs .ugb-panel-tabs__wrapper,
2930
.ugb-panel-tabs .ugb-panel-tabs__wrapper > button {
3031
background-color: #f5f5f5 !important;

0 commit comments

Comments
 (0)