Skip to content

Commit 41efc08

Browse files
authored
Merge pull request #563 from Shopify/fix-page-spacing
Fixing spacing on Page component with no header
2 parents 63a0adf + 8eaeda6 commit 41efc08

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

src/components/Page/Page.scss

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,15 @@ html, body {
3434
}
3535

3636
.Content {
37-
margin: 0 0 spacing(loose);
37+
margin: spacing(loose) 0;
38+
39+
@include page-content-when-not-partially-condensed {
40+
margin-top: spacing(extra-loose);
41+
}
3842
}
3943

4044
.Header {
41-
padding: spacing(loose);
45+
padding: spacing(loose) spacing(loose) 0;
4246

4347
@include page-content-when-not-fully-condensed {
4448
padding-left: 0;
@@ -47,26 +51,20 @@ html, body {
4751

4852
@include page-content-when-not-partially-condensed {
4953
padding-top: spacing(extra-loose);
50-
padding-bottom: spacing(extra-loose);
5154
}
5255
}
5356

5457
.Header-hasPagination,
5558
.Header-hasBreadcrumbs {
5659
padding-top: spacing(loose);
57-
padding-bottom: rem(24px);
58-
59-
&.Header-hasSecondaryActions {
60-
padding-bottom: spacing(loose);
61-
}
6260
}
6361

6462
.Header-hasSecondaryActions {
6563
padding-top: rem(24px);
66-
padding-bottom: spacing(loose);
6764
}
6865

6966
.Header-hasSeparator {
67+
padding-bottom: spacing();
7068
border-bottom: border();
7169

7270
+ .Content {

src/components/Page/Page.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default class Page extends React.PureComponent<Props, never> {
5353
fullWidth && styles.fullWidth,
5454
);
5555

56-
const headerMarkup = this.context.easdk
56+
const headerMarkup = this.context.easdk || !this.hasHeaderContent()
5757
? null
5858
: <Header {...rest} />;
5959

@@ -74,4 +74,14 @@ export default class Page extends React.PureComponent<Props, never> {
7474
easdk.Bar.update(this.props);
7575
}
7676
}
77+
78+
private hasHeaderContent() {
79+
const { title, primaryAction, secondaryActions, breadcrumbs } = this.props;
80+
return (
81+
(title && title !== '')
82+
|| primaryAction
83+
|| (secondaryActions && secondaryActions.length > 0)
84+
|| (breadcrumbs && breadcrumbs.length > 0)
85+
);
86+
}
7787
}

0 commit comments

Comments
 (0)