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

Try: Temporary color fix for post editor. #36243

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const PanelColorGradientSettingsMultipleSelect = ( props ) => {
const result = [];
if ( coreColors && coreColors.length ) {
result.push( {
name: __( 'Core' ),
name: __( 'Default' ),
colors: coreColors,
} );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const categories = [
export const collections = {
core: {
icon: undefined,
title: 'Core',
title: 'Default',
},
};

Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/circular-option-picker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ function DropdownLinkAction( {
aria-expanded={ isOpen }
aria-haspopup="true"
onClick={ onToggle }
variant="link"
isSmall
variant="secondary"
{ ...buttonProps }
>
{ linkText }
Expand Down
22 changes: 18 additions & 4 deletions packages/components/src/circular-option-picker/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ $color-palette-circle-spacing: 12px;
min-width: 188px;

.components-circular-option-picker__custom-clear-wrapper {
margin-top: $grid-unit-20;
margin-bottom: $grid-unit-10;
display: flex;
justify-content: flex-end;
}
Expand Down Expand Up @@ -127,10 +129,22 @@ $color-palette-circle-spacing: 12px;
}


.components-circular-option-picker__dropdown-link-action {
margin-right: $grid-unit-20;
.components-circular-option-picker__dropdown-link-action + .components-button {
margin-left: $grid-unit-10;
}

// Temporarily hide the color card from the post editor, but keep it for Global Styles.
// @todo: this should be removed and retired entirely when colors in the post editor are
// able to use the ItemGroup component to handle color options.
// https://github.com/WordPress/gutenberg/issues/35093
.edit-post-sidebar .block-editor-panel-color-gradient-settings .components-flex > .components-dropdown {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do quite dislike using CSS to ambiguate between global styles and the post editor. But it's a simple way to get this working, and it sits here in CSS that will be mostly retired as we get a chance to revisit this. I'd be happy to be pointed towards a better solution if you can.

display: none;

.components-button {
line-height: 22px;
& + div {
margin-top: 0;
}
}

.edit-site .components-circular-option-picker__dropdown-link-action {
display: none;
}
29 changes: 22 additions & 7 deletions packages/components/src/color-palette/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,28 @@ export default function ColorPalette( {
onChange={ onChange }
value={ value }
actions={
!! clearable && (
<CircularOptionPicker.ButtonAction
onClick={ clearColor }
>
{ __( 'Clear' ) }
</CircularOptionPicker.ButtonAction>
)
<>
{ ! disableCustomColors && (
<CircularOptionPicker.DropdownLinkAction
dropdownProps={ {
renderContent: renderCustomColorPicker,
contentClassName:
'components-color-palette__picker',
} }
buttonProps={ {
'aria-label': __( 'Custom color picker' ),
} }
linkText={ __( 'Custom' ) }
/>
) }
{ !! clearable && (
<CircularOptionPicker.ButtonAction
onClick={ clearColor }
>
{ __( 'Clear' ) }
</CircularOptionPicker.ButtonAction>
) }
</>
}
/>
</VStack>
Expand Down
4 changes: 2 additions & 2 deletions packages/edit-site/src/components/global-styles/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export function useColorsPerOrigin( name ) {
const result = [];
if ( coreColors && coreColors.length ) {
result.push( {
name: __( 'Core' ),
name: __( 'Default' ),
colors: coreColors,
} );
}
Expand Down Expand Up @@ -253,7 +253,7 @@ export function useGradientsPerOrigin( name ) {
const result = [];
if ( coreGradients && coreGradients.length ) {
result.push( {
name: __( 'Core' ),
name: __( 'Default' ),
gradients: coreGradients,
} );
}
Expand Down