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

ColorPalette: Make popover style consistent #43570

Merged
merged 2 commits into from
Aug 26, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

- `CustomGradientPicker`, `GradientPicker`: Add `__nextHasNoMargin` prop for opting into the new margin-free styles ([#43387](https://github.com/WordPress/gutenberg/pull/43387)).
- `ToolsPanel`: Tighten grid gaps ([#43424](https://github.com/WordPress/gutenberg/pull/43424)).
- `ColorPalette`: Make popover style consistent ([#43570](https://github.com/WordPress/gutenberg/pull/43570)).
- `ToggleGroupControl`: Improve TypeScript documentation ([#43265](https://github.com/WordPress/gutenberg/pull/43265)).
- `ComboboxControl`: Normalize hyphen-like characters to an ASCII hyphen ([#42942](https://github.com/WordPress/gutenberg/pull/42942)).
- `FormTokenField`: Refactor away from `_.difference()` ([#43224](https://github.com/WordPress/gutenberg/pull/43224/)).
Expand Down
13 changes: 8 additions & 5 deletions packages/components/src/color-palette/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { VStack } from '../v-stack';
import { Flex, FlexItem } from '../flex';
import { Truncate } from '../truncate';
import { ColorHeading } from './styles';
import DropdownContentWrapper from '../dropdown/dropdown-content-wrapper';

extend( [ namesPlugin, a11yPlugin ] );

Expand Down Expand Up @@ -202,11 +203,13 @@ export default function ColorPalette( {
const Component = showMultiplePalettes ? MultiplePalettes : SinglePalette;

const renderCustomColorPicker = () => (
<ColorPicker
color={ value }
onChange={ ( color ) => onChange( color ) }
enableAlpha={ enableAlpha }
/>
<DropdownContentWrapper paddingSize="none">
<ColorPicker
color={ value }
onChange={ ( color ) => onChange( color ) }
enableAlpha={ enableAlpha }
/>
</DropdownContentWrapper>
);

const colordColor = colord( value );
Expand Down
14 changes: 0 additions & 14 deletions packages/components/src/color-palette/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,6 @@
}
}

.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content {
overflow: visible;
Copy link
Member Author

Choose a reason for hiding this comment

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

This was already being overridden by an inline style that sets overflow: auto.

box-shadow: 0 4px 4px rgba(0, 0, 0, 0.05);
border: none;
outline: none;
border-radius: $radius-block-ui;
padding: 0;

.react-colorful__saturation {
border-top-right-radius: $radius-block-ui;
border-top-left-radius: $radius-block-ui;
}
Comment on lines -42 to -45
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed because this is only necessary when overflow: visible.

}

.components-color-palette__custom-color-name {
text-align: left;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ColorPalette Dropdown .renderContent should render dropdown content 1`] = `
<ColorPicker
color="#f00"
onChange={[Function]}
/>
<DropdownContentWrapperDiv
className="components-dropdown-content-wrapper"
data-wp-c16t={true}
data-wp-component="DropdownContentWrapper"
paddingSize="none"
>
<LegacyAdapter
color="#f00"
onChange={[Function]}
/>
</DropdownContentWrapperDiv>
`;

exports[`ColorPalette Dropdown .renderToggle should render dropdown content 1`] = `
Expand Down