Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Handle border radius px units
  • Loading branch information
aaronrobertshaw committed Jan 20, 2021
commit 15bf3d6fc762227d8da8fd50ca2996a4b497ac11
15 changes: 10 additions & 5 deletions packages/edit-site/src/components/sidebar/border-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,25 @@ export default function BorderPanel( {
setStyle,
} ) {
const hasBorderRadius = useHasBorderRadiusControl( { supports, name } );
const borderRadiusValue = parseInt(
getStyle( name, 'borderRadius' ) || 0,
10
);

return (
<PanelBody title={ __( 'Border' ) } initialOpen={ true }>
{ hasBorderRadius && (
<RangeControl
value={ getStyle( name, 'borderRadius' ) }
value={ borderRadiusValue }
label={ __( 'Border radius' ) }
min={ MIN_BORDER_RADIUS_VALUE }
max={ MAX_BORDER_RADIUS_VALUE }
initialPosition={ getStyle( name, 'borderRadius' ) || 0 }
initialPosition={ borderRadiusValue }
allowReset
onChange={ ( value ) =>
setStyle( name, 'borderRadius', value )
}
onChange={ ( value ) => {
const radiusStyle = value ? `${ value }px` : undefined;
setStyle( name, 'borderRadius', radiusStyle );
} }
/>
) }
</PanelBody>
Expand Down