Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Use [the changelog guidelines](/documentation/Versioning%20and%20changelog.md) t
- Added new `duplicateRootItem` prop to a Navigation Section to support new mobile Navigation IA ([#4902](https://github.com/Shopify/polaris-react/pull/4902))
- Updated mobile behaviour of Navigation to only show one sub-section at a time ([#4902](https://github.com/Shopify/polaris-react/pull/4902))
- Remove the info icon and external link guidance from FooterHelp ([#4982](https://github.com/Shopify/polaris-react/pull/4982))
- Normalise spacing around the `Header` within the `Page` ([#4911](https://github.com/Shopify/polaris-react/pull/4911))

### Bug fixes

Expand Down
2 changes: 1 addition & 1 deletion src/components/Page/Page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ body {
}

.divider {
border-top: border();
border-top: border(divider);
padding-top: spacing();
}
2 changes: 1 addition & 1 deletion src/components/Page/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function Page({
(rest.breadcrumbs != null && rest.breadcrumbs.length > 0);

const contentClassName = classNames(
styles.Content,
!hasHeaderContent && styles.Content,
divider && hasHeaderContent && styles.divider,
);

Expand Down
40 changes: 30 additions & 10 deletions src/components/Page/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ Use for detail pages, which should have pagination and breadcrumbs, and also oft
}}
additionalNavigation={<Avatar size="small" initials="CD" customer={false} />}
>
<p>Page content</p>
<Card title="Credit card" sectioned>
<p>Credit card information</p>
</Card>
</Page>
```

Expand Down Expand Up @@ -223,7 +225,9 @@ Use to create a custom primary action.
</Button>
}
>
<p>Page content</p>
<Card title="Credit card" sectioned>
<p>Credit card information</p>
</Card>
</Page>
```

Expand Down Expand Up @@ -286,7 +290,9 @@ Use when the page title benefits from secondary content.
subtitle="Statement period: May 3, 2019 to June 2, 2019"
secondaryActions={[{content: 'Download', icon: ArrowDownMinor}]}
>
<p>Page content</p>
<Card title="Credit card" sectioned>
<p>Credit card information</p>
</Card>
</Page>
```

Expand Down Expand Up @@ -332,7 +338,9 @@ Use when an image will help merchants identify the purpose of the page.
hasNext: true,
}}
>
<p>Page content</p>
<Card title="Credit card" sectioned>
<p>Credit card information</p>
</Card>
</Page>
```

Expand All @@ -355,7 +363,9 @@ Use when a secondary action links to another website. Actions marked external op
},
]}
>
<p>Page Content</p>
<Card title="Credit card" sectioned>
<p>Credit card information</p>
</Card>
</Page>
```

Expand All @@ -371,7 +381,9 @@ Use when the page doesn’t represent a list of objects or a detail view for an
title="General"
primaryAction={{content: 'Save'}}
>
<p>Page content</p>
<Card title="Credit card" sectioned>
<p>Credit card information</p>
</Card>
</Page>
```

Expand All @@ -391,7 +403,9 @@ Use for layouts that benefit from more screen width, such as wide tables or list
hasNext: true,
}}
>
<p>Wide page content</p>
<Card title="Credit card" sectioned>
<p>Credit card information</p>
</Card>
</Page>
```

Expand Down Expand Up @@ -439,7 +453,9 @@ Use action groups for sets of actions that relate to one another, particularly w
},
]}
>
<p>Page content</p>
<Card title="Credit card" sectioned>
<p>Credit card information</p>
</Card>
</Page>
```

Expand All @@ -461,7 +477,9 @@ Title metadata appears immediately after the page’s title. Use it to communica
hasNext: true,
}}
>
<p>Page content</p>
<Card title="Credit card" sectioned>
<p>Credit card information</p>
</Card>
</Page>
```

Expand All @@ -477,7 +495,9 @@ Use when the page needs visual separation between the page header and the conten
title="General"
divider
>
<p>Page content</p>
<Card title="Credit card" sectioned>
<p>Credit card information</p>
</Card>
</Page>
```

Expand Down
3 changes: 3 additions & 0 deletions src/components/Page/components/Header/Header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ $action-menu-rollup-computed-width: rem(40px);
// stylelint-disable-next-line selector-max-class
.RightAlign {
margin-bottom: spacing(extra-tight);
@include breakpoint-after(layout-width(page-with-nav)) {
margin-bottom: 0;
}
}
// stylelint-disable-next-line selector-max-class
.Row {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
}
}

.TitleWithSubtitle {
margin-top: spacing(extra-tight);
}

.SubTitle {
margin-top: spacing(tight);
margin-top: spacing(extra-tight);
color: var(--p-text-subdued);

&.SubtitleCompact {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ export function Title({
console.warn('The thumbnail prop from Page has been deprecated');
}

const titleMarkup = title ? <h1 className={styles.Title}>{title}</h1> : null;
const titleMarkup = title ? (
<h1
className={classNames(styles.Title, subtitle && styles.TitleWithSubtitle)}
>
{title}
</h1>
) : null;

const titleMetadataMarkup = titleMetadata ? (
<div className={styles.TitleMetadata}>{titleMetadata}</div>
Expand Down
7 changes: 2 additions & 5 deletions src/components/Page/tests/Page.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ describe('<Page />', () => {
it('renders border when divider is true and header props exist', () => {
const wrapper = mountWithApp(<Page {...mockProps} divider />);
expect(wrapper).toContainReactComponent('div', {
className: 'Content divider',
className: 'divider',
});
});

Expand All @@ -281,10 +281,7 @@ describe('<Page />', () => {
it('does not render border when divider is false', () => {
const wrapper = mountWithApp(<Page {...mockProps} divider={false} />);
expect(wrapper).not.toContainReactComponent('div', {
className: 'Content divider',
});
expect(wrapper).toContainReactComponent('div', {
className: 'Content',
className: 'divider',
});
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/styles/shared/_page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ $actions-vertical-spacing: spacing(tight);
margin: spacing(tight) 0;

@include page-content-when-not-partially-condensed {
margin-top: spacing(tight);
margin-top: spacing(loose);
}
}

Expand All @@ -46,15 +46,15 @@ $actions-vertical-spacing: spacing(tight);
}

@mixin page-header-layout {
padding: spacing() spacing() 0;
padding: spacing();

@include page-content-when-not-fully-condensed {
padding-left: 0;
padding-right: 0;
}

@include page-content-when-not-partially-condensed {
padding-top: spacing();
padding: spacing(loose) 0;
}
}

Expand Down