Skip to content
2 changes: 2 additions & 0 deletions UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Use [the changelog guidelines](https://git.io/polaris-changelog-guidelines) to f

### Bug fixes

- Fixed `Action`s selector in `Page`'s `Header` component ([#2487](https://github.com/Shopify/polaris-react/pull/2487))

### Documentation

### Development workflow
4 changes: 3 additions & 1 deletion src/components/Page/components/Header/Header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ $action-horizontal-padding: (1.5 * spacing(tight));
display: flex;
align-items: center;

> * {
> .IndividualAction {
display: inline-flex;

&:first-child {
// Compensates for the fact that we push the icon slightly to the left
margin-left: -1 * $action-horizontal-padding;
Expand Down
32 changes: 18 additions & 14 deletions src/components/Page/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,21 @@ export default class Header extends React.PureComponent<Props, State> {

const actionGroupsMarkup =
actionGroups.length > 0
? actionGroups.map(({title, icon, actions, details}) => (
<ActionGroup
key={title}
title={title}
icon={icon}
actions={actions}
details={details}
onOpen={this.handleActionGroupOpen}
onClose={this.handleActionGroupClose}
active={title === openActionGroup}
/>
? actionGroups.map(({title, icon, actions, details}, index) => (
<div
className={styles.IndividualAction}
key={`ActionGroup-${title}-${index}`}
>
<ActionGroup
title={title}
icon={icon}
actions={actions}
details={details}
onOpen={this.handleActionGroupOpen}
onClose={this.handleActionGroupClose}
active={title === openActionGroup}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this logic be in a variable?

Copy link
Member Author

@kvendrik kvendrik Nov 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say yes although I think in this specific case its okay to leave it as is considering storing this in a variable would involve changing this into a block which would arguably make it harder to read.

/>
</div>
))
: null;

Expand Down Expand Up @@ -263,8 +267,8 @@ function secondaryActionsFrom(
actions: SecondaryAction[],
): ReadonlyArray<JSX.Element> {
return actions.map(({content, ...action}, index) => (
<Action {...action} key={`Action-${content || index}`}>
{content}
</Action>
<div className={styles.IndividualAction} key={`Action-${content || index}`}>
<Action {...action}>{content}</Action>
</div>
));
}