Skip to content

Commit

Permalink
InputControl: Tighten gap between input and prefix/suffix (WordPress#…
Browse files Browse the repository at this point in the history
…64908)

* InputControl: Tighten padding between input and prefix/suffix

* Add changelog

* BorderControl: Add back padding

* Add more components to changelog

Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
  • Loading branch information
5 people authored and bph committed Aug 31, 2024
1 parent 31aea0a commit d6b1eb9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 18 deletions.
9 changes: 9 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@
- `UnitControl`: Update unit select styles ([#64712](https://github.com/WordPress/gutenberg/pull/64712)).
- `InputControl`: Add variants to prefix/suffix wrappers ([#64824](https://github.com/WordPress/gutenberg/pull/64824)).
- `Navigator`: remove location history, simplify internal logic ([#64675](https://github.com/WordPress/gutenberg/pull/64675)).
- Tighten gap between the main control and the prefix/suffix slot for the following components ([#64908](https://github.com/WordPress/gutenberg/pull/64908)).
- `InputControl`
- `NumberControl`
- `SelectControl`
- `TreeSelect`
- `UnitControl`
- Contains internal visual changes from this PR:
- `AnglePickerControl`
- `ColorPicker`
- Decrease horizontal padding from 16px to 12px on the following components, when in the 40px default size ([#64708](https://github.com/WordPress/gutenberg/pull/64708)).
- `AnglePickerControl`
- `ColorPicker` (on the inputs)
Expand Down
39 changes: 23 additions & 16 deletions packages/components/src/border-control/border-control/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { contextConnect } from '../../context';
import { useBorderControl } from './hook';

import type { BorderControlProps, LabelProps } from '../types';
import { Spacer } from '../../spacer';

const BorderLabel = ( props: LabelProps ) => {
const { label, hideLabelFromVision } = props;
Expand Down Expand Up @@ -75,22 +76,28 @@ const UnconnectedBorderControl = (
<HStack spacing={ 4 } className={ innerWrapperClassName }>
<UnitControl
prefix={
<BorderControlDropdown
border={ border }
colors={ colors }
__unstablePopoverProps={ __unstablePopoverProps }
disableCustomColors={ disableCustomColors }
enableAlpha={ enableAlpha }
enableStyle={ enableStyle }
isStyleSettable={ isStyleSettable }
onChange={ onBorderChange }
previousStyleSelection={ previousStyleSelection }
showDropdownHeader={ showDropdownHeader }
__experimentalIsRenderedInSidebar={
__experimentalIsRenderedInSidebar
}
size={ size }
/>
<Spacer marginRight={ 1 } marginBottom={ 0 }>
<BorderControlDropdown
border={ border }
colors={ colors }
__unstablePopoverProps={
__unstablePopoverProps
}
disableCustomColors={ disableCustomColors }
enableAlpha={ enableAlpha }
enableStyle={ enableStyle }
isStyleSettable={ isStyleSettable }
onChange={ onBorderChange }
previousStyleSelection={
previousStyleSelection
}
showDropdownHeader={ showDropdownHeader }
__experimentalIsRenderedInSidebar={
__experimentalIsRenderedInSidebar
}
size={ size }
/>
</Spacer>
}
label={ __( 'Border width' ) }
hideLabelFromVision
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/input-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ export function UnforwardedInputControl(
isPressEnterToChange={ isPressEnterToChange }
onKeyDown={ onKeyDown }
onValidate={ onValidate }
paddingInlineStart={ prefix ? space( 2 ) : undefined }
paddingInlineEnd={ suffix ? space( 2 ) : undefined }
paddingInlineStart={ prefix ? space( 1 ) : undefined }
paddingInlineEnd={ suffix ? space( 1 ) : undefined }
ref={ ref }
size={ size }
stateReducer={ stateReducer }
Expand Down

0 comments on commit d6b1eb9

Please sign in to comment.