-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Components: Decrease standard padding to 12px #64708
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,10 @@ | |
*/ | ||
import { HStack } from '../h-stack'; | ||
import { Text } from '../text'; | ||
import { Spacer } from '../spacer'; | ||
import { space } from '../utils/space'; | ||
import { RangeControl, NumberControlWrapper } from './styles'; | ||
import { COLORS } from '../utils/colors-values'; | ||
import type { InputWithSliderProps } from './types'; | ||
import InputControlPrefixWrapper from '../input-control/input-prefix-wrapper'; | ||
|
||
export const InputWithSlider = ( { | ||
min, | ||
|
@@ -39,14 +38,11 @@ export const InputWithSlider = ( { | |
value={ value } | ||
onChange={ onNumberControlChange } | ||
prefix={ | ||
<Spacer | ||
as={ Text } | ||
paddingLeft={ space( 4 ) } | ||
color={ COLORS.theme.accent } | ||
lineHeight={ 1 } | ||
> | ||
{ abbreviation } | ||
</Spacer> | ||
<InputControlPrefixWrapper> | ||
<Text color={ COLORS.theme.accent } lineHeight={ 1 }> | ||
{ abbreviation } | ||
</Text> | ||
</InputControlPrefixWrapper> | ||
Comment on lines
+41
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
spinControls="none" | ||
size="__unstable-large" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,9 +21,9 @@ const ANIMATION_PARAMS = { | |
}; | ||
|
||
const INLINE_PADDING = { | ||
compact: 8, // space(2) | ||
small: 8, // space(2) | ||
default: 16, // space(4) | ||
compact: CONFIG.controlPaddingXSmall, | ||
small: CONFIG.controlPaddingXSmall, | ||
default: CONFIG.controlPaddingX, | ||
Comment on lines
+24
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
}; | ||
|
||
const getSelectSize = ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ import { Flex, FlexItem } from '../../flex'; | |
import { Text } from '../../text'; | ||
import { baseLabelTypography, COLORS, CONFIG, rtl } from '../../utils'; | ||
import type { LabelPosition, Size } from '../types'; | ||
import { space } from '../../utils/space'; | ||
|
||
type ContainerProps = { | ||
disabled?: boolean; | ||
|
@@ -188,29 +187,29 @@ export const getSizeConfig = ( { | |
height: 40, | ||
lineHeight: 1, | ||
minHeight: 40, | ||
paddingLeft: space( 4 ), | ||
paddingRight: space( 4 ), | ||
paddingLeft: CONFIG.controlPaddingX, | ||
paddingRight: CONFIG.controlPaddingX, | ||
Comment on lines
+190
to
+191
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
}, | ||
small: { | ||
height: 24, | ||
lineHeight: 1, | ||
minHeight: 24, | ||
paddingLeft: space( 2 ), | ||
paddingRight: space( 2 ), | ||
paddingLeft: CONFIG.controlPaddingXSmall, | ||
paddingRight: CONFIG.controlPaddingXSmall, | ||
}, | ||
compact: { | ||
height: 32, | ||
lineHeight: 1, | ||
minHeight: 32, | ||
paddingLeft: space( 2 ), | ||
paddingRight: space( 2 ), | ||
paddingLeft: CONFIG.controlPaddingXSmall, | ||
paddingRight: CONFIG.controlPaddingXSmall, | ||
}, | ||
'__unstable-large': { | ||
height: 40, | ||
lineHeight: 1, | ||
minHeight: 40, | ||
paddingLeft: space( 4 ), | ||
paddingRight: space( 4 ), | ||
paddingLeft: CONFIG.controlPaddingX, | ||
paddingRight: CONFIG.controlPaddingX, | ||
}, | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,12 +105,12 @@ const paddingYLarge = `calc((${ CONFIG.controlHeightLarge } - ${ baseFontHeight | |
|
||
export const itemSizes = { | ||
small: css` | ||
padding: ${ paddingYSmall } ${ CONFIG.controlPaddingXSmall }; | ||
padding: ${ paddingYSmall } ${ CONFIG.controlPaddingXSmall }px; | ||
`, | ||
medium: css` | ||
padding: ${ paddingY } ${ CONFIG.controlPaddingX }; | ||
padding: ${ paddingY } ${ CONFIG.controlPaddingX }px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
`, | ||
large: css` | ||
padding: ${ paddingYLarge } ${ CONFIG.controlPaddingXLarge }; | ||
padding: ${ paddingYLarge } ${ CONFIG.controlPaddingXLarge }px; | ||
`, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ import styled from '@emotion/styled'; | |
/** | ||
* Internal dependencies | ||
*/ | ||
import { COLORS, rtl } from '../../utils'; | ||
import { COLORS, rtl, CONFIG } from '../../utils'; | ||
import { space } from '../../utils/space'; | ||
import type { SelectControlProps } from '../types'; | ||
import InputControlSuffixWrapper from '../../input-control/input-suffix-wrapper'; | ||
|
@@ -108,10 +108,10 @@ const sizePaddings = ( { | |
selectSize = 'default', | ||
}: SelectProps ) => { | ||
const padding = { | ||
default: 16, | ||
small: 8, | ||
compact: 8, | ||
'__unstable-large': 16, | ||
default: CONFIG.controlPaddingX, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
small: CONFIG.controlPaddingXSmall, | ||
compact: CONFIG.controlPaddingXSmall, | ||
'__unstable-large': CONFIG.controlPaddingX, | ||
}; | ||
|
||
if ( ! __next40pxDefaultSize ) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,8 @@ | |
|
||
// Subtract 1px to account for the border, which isn't included on the element | ||
// on newer components like InputControl, SelectControl, etc. | ||
padding-left: $grid-unit-20; | ||
padding-right: $grid-unit-20; | ||
// These values should be shared with the `controlPaddingX` in ./utils/config-values.js | ||
padding-left: $grid-unit-15; | ||
padding-right: $grid-unit-15; | ||
Comment on lines
+26
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,14 +5,16 @@ import { space } from './space'; | |
import { COLORS } from './colors-values'; | ||
|
||
const CONTROL_HEIGHT = '36px'; | ||
const CONTROL_PADDING_X = '12px'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should soon make a decision about how we want to define our foundational variables — number, string, or function ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Absolutely. A few considerations that come to mind (more of a brain dump):
|
||
|
||
const CONTROL_PROPS = { | ||
controlSurfaceColor: COLORS.white, | ||
controlTextActiveColor: COLORS.theme.accent, | ||
controlPaddingX: CONTROL_PADDING_X, | ||
controlPaddingXLarge: `calc(${ CONTROL_PADDING_X } * 1.3334)`, | ||
controlPaddingXSmall: `calc(${ CONTROL_PADDING_X } / 1.3334)`, | ||
|
||
// These values should be shared with TextControl. | ||
controlPaddingX: 12, | ||
controlPaddingXSmall: 8, | ||
controlPaddingXLarge: 12 * 1.3334, // TODO: Deprecate | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ItemGroup already does have a 12px padding in the default size, interestingly. We'll probably deprecate the |
||
|
||
controlBackgroundColor: COLORS.white, | ||
controlBoxShadow: 'transparent', | ||
controlBoxShadowFocus: `0 0 0 0.5px ${ COLORS.theme.accent }`, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.