Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: Uneditable duotone palette on the palette gradient panel #36920

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 8 additions & 5 deletions packages/components/src/duotone-picker/duotone-picker.js
Expand Up @@ -19,6 +19,7 @@ import CustomDuotoneBar from './custom-duotone-bar';
import { getDefaultColors, getGradientFromCSSColors } from './utils';

function DuotonePicker( {
clearable = true,
colorPalette,
duotonePalette,
disableCustomColors,
Expand Down Expand Up @@ -69,11 +70,13 @@ function DuotonePicker( {
);
} ) }
actions={
<CircularOptionPicker.ButtonAction
onClick={ () => onChange( undefined ) }
>
{ __( 'Clear' ) }
</CircularOptionPicker.ButtonAction>
!! clearable && (
<CircularOptionPicker.ButtonAction
onClick={ () => onChange( undefined ) }
>
{ __( 'Clear' ) }
</CircularOptionPicker.ButtonAction>
)
}
>
{ ! disableCustomColors && ! disableCustomDuotone && (
Expand Down
@@ -1,9 +1,16 @@
/**
* External dependencies
*/
import { noop } from 'lodash';

/**
* WordPress dependencies
*/
import {
__experimentalVStack as VStack,
__experimentalPaletteEdit as PaletteEdit,
DuotonePicker,
__experimentalHeading as Heading,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';

Expand Down Expand Up @@ -40,11 +47,24 @@ export default function GradientPalettePanel( { name } ) {
'color.defaultGradients',
name
);
const [ duotonePalette ] = useSetting( 'color.duotone' ) || [];
return (
<VStack
className="edit-site-global-styles-gradient-palette-panel"
spacing={ 10 }
>
<div>
<Heading className="edit-site-global-styles-gradient-palette-panel__duotone-heading">
{ __( 'Duotone' ) }
</Heading>
<DuotonePicker
duotonePalette={ duotonePalette }
disableCustomDuotone={ true }
disableCustomColors={ true }
clearable={ false }
onChange={ noop }
/>
</div>
{ !! themeGradients && !! themeGradients.length && (
<PaletteEdit
canReset={ themeGradients !== baseThemeGradients }
Expand Down
8 changes: 8 additions & 0 deletions packages/edit-site/src/components/global-styles/style.scss
Expand Up @@ -77,3 +77,11 @@
min-height: $grid-unit-40;
}
}

h2.edit-site-global-styles-gradient-palette-panel__duotone-heading.components-heading {
text-transform: uppercase;
line-height: $grid-unit-30;
font-weight: 500;
font-size: 11px;
margin-bottom: $grid-unit-10;
}