Skip to content

Commit

Permalink
ColorPicker: Cleanly implement large size (#42002)
Browse files Browse the repository at this point in the history
* ColorPicker: Cleanly implement large size

* Add changelog

* Fix prefix spacing
  • Loading branch information
mirka authored Jul 15, 2022
1 parent 3136704 commit 40ba2c9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

### Internal

- `ColorPicker`: Clean up implementation of 40px size ([#42002](https://github.com/WordPress/gutenberg/pull/42002/)).
- `Divider`: Complete TypeScript migration ([#41991](https://github.com/WordPress/gutenberg/pull/41991)).
- `Divider`, `Flex`, `Spacer`: Improve documentation for the `SpaceInput` prop ([#42376](https://github.com/WordPress/gutenberg/pull/42376)).
- `Elevation`: Convert to TypeScript ([#42302](https://github.com/WordPress/gutenberg/pull/42302)).
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/color-picker/hex-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const HexInput = ( { color, onChange, enableAlpha }: HexInputProps ) => {
prefix={
<Spacer
as={ Text }
marginLeft={ space( 3.5 ) }
marginLeft={ space( 4 ) }
color={ COLORS.ui.theme }
lineHeight={ 1 }
>
Expand All @@ -65,6 +65,7 @@ export const HexInput = ( { color, onChange, enableAlpha }: HexInputProps ) => {
maxLength={ enableAlpha ? 9 : 7 }
label={ __( 'Hex color' ) }
hideLabelFromVision
size="__unstable-large"
__unstableStateReducer={ stateReducer }
__unstableInputWidth="9em"
/>
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/color-picker/input-with-slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ export const InputWithSlider = ( {
prefix={
<Spacer
as={ Text }
paddingLeft={ space( 3.5 ) }
paddingLeft={ space( 4 ) }
color={ COLORS.ui.theme }
lineHeight={ 1 }
>
{ abbreviation }
</Spacer>
}
hideHTMLArrows
size="__unstable-large"
/>
<RangeControl
label={ label }
Expand Down
11 changes: 0 additions & 11 deletions packages/components/src/color-picker/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { HStack } from '../h-stack';
import {
BackdropUI,
Container as InputControlContainer,
Input,
} from '../input-control/styles/input-control-styles';
import CONFIG from '../utils/config-values';

Expand All @@ -44,14 +43,6 @@ export const RangeControl = styled( InnerRangeControl )`
}
`;

// All inputs should be the same height so this should be changed at the component level.
// That involves changing heights of multiple input types probably buttons too etc.
// So until that is done we are already using the new height on the color picker so it matches the mockups.
const inputHeightStyle = `
&&& ${ Input } {
height: 40px;
}`;

// Make the Hue circle picker not go out of the bar.
const interactiveHueStyles = `
.react-colorful__interactive {
Expand Down Expand Up @@ -125,8 +116,6 @@ export const ColorfulWrapper = styled.div`
${ StyledField } {
margin-bottom: 0;
}
${ inputHeightStyle }
`;

export const CopyButton = styled( Button )`
Expand Down

0 comments on commit 40ba2c9

Please sign in to comment.