Skip to content

Commit 4956690

Browse files
aduthjuanfra
andauthored
UI: Remove shorthand prop options from Box component (#73529)
Co-authored-by: aduth <[email protected]> Co-authored-by: juanfra <[email protected]>
1 parent 59d9d10 commit 4956690

File tree

3 files changed

+6
-34
lines changed

3 files changed

+6
-34
lines changed

packages/ui/src/box/box.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,28 +84,25 @@ export const Box = forwardRef< HTMLDivElement, BoxProps >( function Box(
8484
backgroundColor,
8585
color,
8686
padding,
87-
bg = backgroundColor,
88-
fg = color,
89-
p = padding,
9087
render = DEFAULT_RENDER,
9188
...props
9289
},
9390
ref
9491
) {
9592
const style: React.CSSProperties = {};
9693

97-
if ( bg ) {
98-
style.backgroundColor = `var(--wpds-color-bg-${ target }-${ bg }, var(--wpds-color-bg-surface-${ bg }))`;
94+
if ( backgroundColor ) {
95+
style.backgroundColor = `var(--wpds-color-bg-${ target }-${ backgroundColor }, var(--wpds-color-bg-surface-${ backgroundColor }))`;
9996
}
10097

101-
if ( fg ) {
102-
style.color = `var(--wpds-color-fg-${ target }-${ fg }, var(--wpds-color-fg-content-${ fg }))`;
98+
if ( color ) {
99+
style.color = `var(--wpds-color-fg-${ target }-${ color }, var(--wpds-color-fg-content-${ color }))`;
103100
}
104101

105-
if ( p ) {
102+
if ( padding ) {
106103
Object.assign(
107104
style,
108-
getDimensionVariantStyles( 'padding', target, p )
105+
getDimensionVariantStyles( 'padding', target, padding )
109106
);
110107
}
111108

packages/ui/src/box/stories/index.story.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ export const Default: Story = {
3030
padding: 'sm',
3131
},
3232
argTypes: {
33-
p: {
34-
control: 'select',
35-
options: [ '2xs', 'xs', 'sm', 'md', 'lg', 1, 2, 3, 4 ],
36-
},
3733
padding: {
3834
control: 'select',
3935
options: [ '2xs', 'xs', 'sm', 'md', 'lg', 1, 2, 3, 4 ],

packages/ui/src/box/types.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,37 +52,16 @@ export interface BoxProps extends ComponentProps< 'div' > {
5252
*/
5353
target?: string;
5454

55-
/**
56-
* The surface background design token for box background color.
57-
*
58-
* Shorthand for `backgroundColor`.
59-
*/
60-
bg?: BackgroundColor;
61-
6255
/**
6356
* The surface background design token for box background color.
6457
*/
6558
backgroundColor?: BackgroundColor;
6659

67-
/**
68-
* The surface foreground design token for box text color.
69-
*
70-
* Shorthand for `color`.
71-
*/
72-
fg?: ForegroundColor;
73-
7460
/**
7561
* The surface foreground design token for box text color.
7662
*/
7763
color?: ForegroundColor;
7864

79-
/**
80-
* The surface spacing design token or base unit multiplier for box padding.
81-
*
82-
* Shorthand for `padding`.
83-
*/
84-
p?: Size | DimensionVariant< Size >;
85-
8665
/**
8766
* The surface spacing design token or base unit multiplier for box padding.
8867
*/

0 commit comments

Comments
 (0)