Skip to content

Commit 1016e15

Browse files
authored
Merge pull request #1994 from Shopify/non-primary-primaryaction
[Page] Give primaryAction more Button variants
2 parents 5c443c1 + c739787 commit 1016e15

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [these versioning and changelog guidelines][changelog-gui
66

77
<!-- ## Unreleased -->
88

9+
### Enhancements
10+
11+
- Updated the page component's primary action to support `Button` props. ([#1994](https://github.com/Shopify/polaris-react/pull/1994))
12+
913
## 2.6.1 - 2018-08-21
1014

1115
### Development workflow

src/components/Page/components/Header/Header.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,13 @@ export default class Header extends React.PureComponent<Props, State> {
5252
const breadcrumbMarkup =
5353
breadcrumbs.length > 0 ? <Breadcrumbs breadcrumbs={breadcrumbs} /> : null;
5454

55+
const primary =
56+
primaryAction &&
57+
(primaryAction.primary === undefined ? true : primaryAction.primary);
58+
5559
const primaryActionMarkup = primaryAction ? (
5660
<div className={styles.PrimaryAction}>
57-
{buttonsFrom(primaryAction, {primary: true})}
61+
{buttonsFrom(primaryAction, {primary})}
5862
</div>
5963
) : null;
6064

src/components/Page/types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import {
22
ActionListItemDescriptor,
3+
Action,
34
IconableAction,
45
DisableableAction,
5-
LoadableAction,
66
BadgeAction,
77
} from '../../types';
88
import {PaginationDescriptor} from '../Pagination';
99
import {Props as BreadcrumbProps} from '../Breadcrumbs';
10+
import {Props as ButtonProps} from '../Button';
1011

1112
export type SecondaryAction = IconableAction & DisableableAction;
1213

@@ -52,7 +53,7 @@ export interface HeaderProps {
5253
/** Collection of page-level groups of secondary actions */
5354
actionGroups?: ActionGroup[];
5455
/** Primary page-level action */
55-
primaryAction?: DisableableAction & LoadableAction;
56+
primaryAction?: Action & ButtonProps;
5657
/** Page-level pagination */
5758
pagination?: PaginationDescriptor;
5859
}

0 commit comments

Comments
 (0)