Skip to content

Conversation

CameronGorrie
Copy link
Contributor

@CameronGorrie CameronGorrie commented Mar 7, 2019

WHY are these changes introduced?

Minimizes impact of re-rendering navigation if the badge relies on a query to resolve. More detail here: https://github.com/Shopify/web/issues/10481

WHAT is this pull request doing?

Allows the nav items badge property to take a react node prop value.

How to 🎩

Copy-paste this code in playground/Playground.tsx:
import * as React from 'react';
import {Page, Navigation, Badge} from '../src';

export default class Playground extends React.Component<{}, never> {
  render() {
    return (
      <Page title="Playground">
        <Navigation location="/">
          <Navigation.Section
            items={[
              {
                url: '/path/to/place',
                label: 'Orders',
                icon: 'orders',
                badge: <Badge>Hello world</Badge>,
              },
            ]}
          />
        </Navigation>
      </Page>
    );
  }
}

🎩 checklist

@CameronGorrie CameronGorrie self-assigned this Mar 7, 2019
@ghost
Copy link

ghost commented Mar 7, 2019

👋 Thanks for opening your first pull request. A contributor should give feedback soon. If you haven’t already, please check out the contributing guidelines. You can also join #polaris on the Shopify Partners Slack.

@BPScott BPScott temporarily deployed to polaris-react-pr-1142 March 7, 2019 18:53 Inactive
@CameronGorrie CameronGorrie force-pushed the navigation-badge-support-jsx branch from ec8d870 to f36a45c Compare March 7, 2019 18:55
@BPScott BPScott temporarily deployed to polaris-react-pr-1142 March 7, 2019 18:55 Inactive
@CameronGorrie CameronGorrie force-pushed the navigation-badge-support-jsx branch from f36a45c to dcde31d Compare March 7, 2019 20:26
@BPScott BPScott temporarily deployed to polaris-react-pr-1142 March 7, 2019 20:26 Inactive
@CameronGorrie CameronGorrie force-pushed the navigation-badge-support-jsx branch from dcde31d to bfff67d Compare March 7, 2019 20:27
@BPScott BPScott temporarily deployed to polaris-react-pr-1142 March 7, 2019 20:27 Inactive
@CameronGorrie CameronGorrie requested a review from michenly March 7, 2019 20:29
@CameronGorrie CameronGorrie force-pushed the navigation-badge-support-jsx branch from bfff67d to 82a5232 Compare March 11, 2019 14:10
@BPScott BPScott temporarily deployed to polaris-react-pr-1142 March 11, 2019 14:11 Inactive
@CameronGorrie CameronGorrie force-pushed the navigation-badge-support-jsx branch from 82a5232 to d2525f6 Compare March 11, 2019 14:19
@BPScott BPScott temporarily deployed to polaris-react-pr-1142 March 11, 2019 14:20 Inactive
@CameronGorrie CameronGorrie requested a review from lemonmade March 11, 2019 14:21
@CameronGorrie CameronGorrie force-pushed the navigation-badge-support-jsx branch from d2525f6 to af2d41a Compare March 11, 2019 16:33
@BPScott BPScott temporarily deployed to polaris-react-pr-1142 March 11, 2019 16:33 Inactive
@CameronGorrie CameronGorrie requested a review from lemonmade March 11, 2019 16:37
@CameronGorrie CameronGorrie force-pushed the navigation-badge-support-jsx branch from af2d41a to b35d656 Compare March 11, 2019 16:55
@CameronGorrie CameronGorrie merged commit 6ac6319 into master Mar 11, 2019
@CameronGorrie CameronGorrie deleted the navigation-badge-support-jsx branch March 11, 2019 17:20
@ghost
Copy link

ghost commented Mar 11, 2019

🎉 Thanks for your contribution to Polaris React!

@chloerice chloerice temporarily deployed to production March 21, 2019 17:48 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants