Skip to content

Commit 4c50413

Browse files
committed
Remove spacing from the normalized layouts
1 parent 2143733 commit 4c50413

File tree

4 files changed

+2
-35
lines changed

4 files changed

+2
-35
lines changed

packages/dataviews/src/dataform-layouts/index.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@ const FORM_FIELD_LAYOUTS = [
1919
{
2020
type: 'regular',
2121
component: FormRegularField,
22-
wrapper: ( {
23-
children,
24-
}: {
25-
children: React.ReactNode;
26-
layout: Layout;
27-
} ) => (
22+
wrapper: ( { children }: { children: React.ReactNode } ) => (
2823
<VStack className="dataforms-layouts__wrapper" spacing={ 4 }>
2924
{ children }
3025
</VStack>
@@ -42,12 +37,7 @@ const FORM_FIELD_LAYOUTS = [
4237
{
4338
type: 'card',
4439
component: FormCardField,
45-
wrapper: ( {
46-
children,
47-
}: {
48-
children: React.ReactNode;
49-
layout: Layout;
50-
} ) => (
40+
wrapper: ( { children }: { children: React.ReactNode } ) => (
5141
<VStack className="dataforms-layouts__wrapper" spacing={ 6 }>
5242
{ children }
5343
</VStack>

packages/dataviews/src/dataform-layouts/normalize-form-fields.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ interface NormalizedFormField {
2121
export const DEFAULT_LAYOUT: NormalizedLayout = {
2222
type: 'regular',
2323
labelPosition: 'top',
24-
spacing: 4,
2524
} as NormalizedRegularLayout;
2625

2726
const normalizeCardSummaryField = (
@@ -51,8 +50,6 @@ export function normalizeLayout( layout?: Layout ): NormalizedLayout {
5150
normalizedLayout = {
5251
type: 'regular',
5352
labelPosition: layout?.labelPosition ?? 'top',
54-
// Spacing is fixed for regular layout.
55-
spacing: 4,
5653
} satisfies NormalizedRegularLayout;
5754
} else if ( layout?.type === 'panel' ) {
5855
const summary = layout.summary ?? [];
@@ -75,8 +72,6 @@ export function normalizeLayout( layout?: Layout ): NormalizedLayout {
7572
withHeader: false,
7673
isOpened: true,
7774
summary: [],
78-
// Spacing is fixed for card layout.
79-
spacing: 6,
8075
} satisfies NormalizedCardLayout;
8176
} else {
8277
const summary = layout.summary ?? [];
@@ -89,8 +84,6 @@ export function normalizeLayout( layout?: Layout ): NormalizedLayout {
8984
? layout.isOpened
9085
: true,
9186
summary: normalizeCardSummaryField( summary ),
92-
// Spacing is fixed for card layout.
93-
spacing: 6,
9487
} satisfies NormalizedCardLayout;
9588
}
9689
} else if ( layout?.type === 'row' ) {

packages/dataviews/src/test/normalize-form-fields.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,13 @@ describe( 'normalizeFormFields', () => {
3131
layout: {
3232
type: 'regular',
3333
labelPosition: 'top',
34-
spacing: 4,
3534
},
3635
},
3736
{
3837
id: 'field2',
3938
layout: {
4039
type: 'regular',
4140
labelPosition: 'top',
42-
spacing: 4,
4341
},
4442
},
4543
] );
@@ -62,7 +60,6 @@ describe( 'normalizeFormFields', () => {
6260
layout: {
6361
type: 'regular',
6462
labelPosition: 'top',
65-
spacing: 4,
6663
},
6764
},
6865
{
@@ -71,7 +68,6 @@ describe( 'normalizeFormFields', () => {
7168
layout: {
7269
type: 'regular',
7370
labelPosition: 'top',
74-
spacing: 4,
7571
},
7672
},
7773
] );
@@ -91,7 +87,6 @@ describe( 'normalizeFormFields', () => {
9187
layout: {
9288
type: 'regular',
9389
labelPosition: 'top',
94-
spacing: 4,
9590
},
9691
},
9792
] );
@@ -109,7 +104,6 @@ describe( 'normalizeFormFields', () => {
109104
layout: {
110105
type: 'regular',
111106
labelPosition: 'side',
112-
spacing: 4,
113107
},
114108
},
115109
] );
@@ -167,7 +161,6 @@ describe( 'normalizeFormFields', () => {
167161
withHeader: true,
168162
isOpened: true,
169163
summary: [],
170-
spacing: 6,
171164
},
172165
},
173166
] );
@@ -194,7 +187,6 @@ describe( 'normalizeFormFields', () => {
194187
withHeader: false,
195188
isOpened: true,
196189
summary: [],
197-
spacing: 6,
198190
},
199191
},
200192
] );
@@ -219,7 +211,6 @@ describe( 'normalizeFormFields', () => {
219211
withHeader: true,
220212
isOpened: false,
221213
summary: [ { id: 'field1', visibility: 'always' } ],
222-
spacing: 6,
223214
},
224215
},
225216
] );
@@ -250,7 +241,6 @@ describe( 'normalizeFormFields', () => {
250241
{ id: 'field2', visibility: 'when-collapsed' },
251242
{ id: 'field1', visibility: 'always' },
252243
],
253-
spacing: 6,
254244
},
255245
},
256246
] );
@@ -276,7 +266,6 @@ describe( 'normalizeFormFields', () => {
276266
layout: {
277267
type: 'regular',
278268
labelPosition: 'top',
279-
spacing: 4,
280269
},
281270
},
282271
{
@@ -311,7 +300,6 @@ describe( 'normalizeFormFields', () => {
311300
withHeader: false,
312301
isOpened: true,
313302
summary: [],
314-
spacing: 6,
315303
},
316304
},
317305
{
@@ -321,7 +309,6 @@ describe( 'normalizeFormFields', () => {
321309
withHeader: true,
322310
isOpened: false,
323311
summary: [],
324-
spacing: 6,
325312
},
326313
},
327314
] );

packages/dataviews/src/types/dataform.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export type RegularLayout = {
1919
export type NormalizedRegularLayout = {
2020
type: 'regular';
2121
labelPosition: LabelPosition;
22-
spacing: number;
2322
};
2423

2524
export type PanelLayout = {
@@ -73,14 +72,12 @@ export type NormalizedCardLayout =
7372
isOpened: true;
7473
// Summary is an empty array
7574
summary: [];
76-
spacing: number;
7775
}
7876
| {
7977
type: 'card';
8078
withHeader: true;
8179
isOpened: boolean;
8280
summary: NormalizedCardSummaryField;
83-
spacing: number;
8481
};
8582

8683
export type RowLayout = {

0 commit comments

Comments
 (0)