Skip to content

Commit 285e4fe

Browse files
committed
serialize layout components
1 parent 7d83615 commit 285e4fe

5 files changed

Lines changed: 79 additions & 15 deletions

File tree

src/components/FlexibleLayout/flexiblelayout.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,19 @@
4646
flex-basis: auto;
4747
}
4848
}
49+
50+
@media print {
51+
.#{$eccgui}-flexible__container,
52+
.#{$eccgui}-flexible__item {
53+
position: relative;
54+
display: block;
55+
width: auto;
56+
height: auto;
57+
padding: 0;
58+
margin: 0;
59+
60+
&:is(.#{$eccgui}-flexible__item) {
61+
margin-bottom: $eccgui-size-block-whitespace;
62+
}
63+
}
64+
}

src/components/Grid/grid.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,20 @@ $grid-gutter: rem($eccgui-size-grid-gutter);
8686
flex-wrap: nowrap;
8787
}
8888
}
89+
90+
@media print {
91+
.#{$eccgui}-grid,
92+
.#{$eccgui}-grid__row,
93+
.#{$eccgui}-grid__column {
94+
position: relative;
95+
display: block;
96+
width: auto;
97+
height: auto;
98+
padding: 0;
99+
margin: 0;
100+
101+
&:is(.#{$eccgui}-grid__column) {
102+
margin-bottom: $eccgui-size-block-whitespace;
103+
}
104+
}
105+
}

src/components/Grid/stories/Grid.stories.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,22 @@ export default {
1111
subcomponents: { GridRow, GridColumn },
1212
argTypes: {
1313
children: {
14-
control: "none",
14+
control: false,
1515
},
1616
},
17+
decorators: [
18+
(Story) => (
19+
<div style={{ minHeight: "30vh", position: "relative" }}>
20+
<Story />
21+
</div>
22+
),
23+
],
1724
} as Meta<typeof Grid>;
1825

19-
const Template: StoryFn<typeof Grid> = (args) => (
20-
<div style={{ minHeight: "30vh", position: "relative" }}>
21-
<Grid {...args} />
22-
</div>
23-
);
26+
const Template: StoryFn<typeof Grid> = (args) => <Grid {...args} />;
2427

2528
export const Default = Template.bind({});
2629
Default.args = {
27-
children: <GridRow {...RowExample.args} verticalStretched />,
30+
children: [<GridRow {...RowExample.args} verticalStretched />, <GridRow {...RowExample.args} verticalStretched />],
2831
verticalStretchable: true,
2932
};

src/components/Grid/stories/GridRow.stories.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,27 @@ export default {
1010
component: GridRow,
1111
argTypes: {
1212
children: {
13-
control: "none",
13+
control: false,
1414
},
1515
},
1616
} as Meta<typeof GridRow>;
1717

18-
const Template: StoryFn<typeof GridRow> = (args) => (
19-
<Grid style={{ minHeight: "30vh" }} verticalStretchable>
20-
<GridRow {...args} />
21-
</Grid>
22-
);
18+
const Template: StoryFn<typeof GridRow> = (args) => <GridRow {...args} />;
2319

2420
export const Default = Template.bind({});
2521
Default.args = {
26-
children: <GridColumn {...ColumnExample.args} verticalAlign="center" />,
22+
children: [
23+
<GridColumn {...ColumnExample.args} verticalAlign="center" key="col1" />,
24+
<GridColumn {...ColumnExample.args} verticalAlign="center" key="col1" />,
25+
],
2726
};
27+
Default.decorators = [
28+
(Story) => (
29+
<Grid style={{ minHeight: "30vh" }} verticalStretchable>
30+
<Story />
31+
</Grid>
32+
),
33+
];
2834

2935
const TemplateStretched: StoryFn<typeof GridRow> = (args) => (
3036
<Grid style={{ minHeight: "50vh" }} verticalStretchable>

src/components/PropertyValuePair/propertyvalue.scss

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
}
66

77
.#{$eccgui}-propertyvalue__pair {
8+
clear: both;
89
display: block;
910
width: 100%;
10-
clear: both;
1111

1212
&.#{$eccgui}-propertyvalue__pair--hasdivider {
1313
&:not(:last-child) {
@@ -94,3 +94,25 @@
9494
}
9595
}
9696
}
97+
98+
@media print {
99+
.#{$eccgui}-propertyvalue__pair,
100+
.#{$eccgui}-propertyvalue__property,
101+
.#{$eccgui}-propertyvalue__value {
102+
position: relative;
103+
float: none !important;
104+
display: block;
105+
width: auto;
106+
height: auto;
107+
min-height: 0 !important;
108+
padding: 0;
109+
margin: 0 !important;
110+
111+
&:is(.#{$eccgui}-propertyvalue__property) {
112+
margin-bottom: 0.25 * $eccgui-size-block-whitespace !important;
113+
}
114+
&:is(.#{$eccgui}-propertyvalue__pair) {
115+
margin-bottom: 0.5 * $eccgui-size-block-whitespace !important;
116+
}
117+
}
118+
}

0 commit comments

Comments
 (0)