Skip to content

Conversation

blazingbbq
Copy link
Contributor

@blazingbbq blazingbbq commented Dec 18, 2018

WHY are these changes introduced?

Rails version of Polaris Action List had a helpText prop.

WHAT is this pull request doing?

These changes add the helpText prop to the ActionList.Item component.

Before:
screen shot 2018-12-18 at 9 26 15 am

After:
screen shot 2018-12-18 at 9 45 34 am

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

Copy-paste this code in playground/Playground.tsx:
import * as React from 'react';
import {Button, ActionList, Popover} from '@shopify/polaris';

interface State {
  active: boolean;
}

export default class Playground extends React.Component<{}, State> {
  state = {
    active: true,
  };

  togglePopover = () => {
    this.setState(({active}) => {
      return {active: !active};
    });
  };

  render() {
    const activator = (
      <Button onClick={this.togglePopover}>More actions</Button>
    );

    return (
      <div style={{height: '250px'}}>
        <Popover
          active={this.state.active}
          activator={activator}
          onClose={this.togglePopover}
        >
          <ActionList
            items={[
              {
                content: 'Blog posts',
                helpText: 'Manage your blog articles',
                icon: 'chevronRight',
                onAction: () => {
                  console.log('File imported');
                },
              },
              {
                content: 'Blogs',
                helpText: 'Manage blogs published to your Online Store',
                onAction: () => {
                  console.log('File exported');
                },
              },
            ]}
          />
        </Popover>
      </div>
    );
  }
}

🎩 checklist

@ghost
Copy link

ghost commented Dec 18, 2018

👋 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 had a problem deploying to polaris-react-pr-777 December 18, 2018 14:54 Failure
Copy link
Contributor

@dfmcphee dfmcphee left a comment

Choose a reason for hiding this comment

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

Could you also add an example to the ActionList README for this? That way we can show the example but we will also get visual regression testing on it as well.

I think something like what we have in the rails version would work.

## Action list with help text

Use help text when the normal Verb noun syntax for the actions does not provide sufficient context for the merchant.

```jsx
<Card>
  <ActionList
    items={[
      {
        content: 'Blog posts',
        onAction: () => {
           console.log('Blog posts clicked');
         },
         helpText: 'Manage your blog articles',
      },
       {
          content: 'Blogs',
          onAction: () => {
            console.log('Blogs clicked');
          },
          helpText: 'Manage blogs published to your Online Store',
        },
     ]}
  />
</Card>

@BPScott BPScott requested a deployment to polaris-react-pr-777 December 18, 2018 15:27 Abandoned
@BPScott BPScott temporarily deployed to polaris-react-pr-777 December 18, 2018 15:34 Inactive
Copy link
Contributor

@dfmcphee dfmcphee left a comment

Choose a reason for hiding this comment

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

Great work. Thanks for adding this!

@BPScott BPScott temporarily deployed to polaris-react-pr-777 December 18, 2018 16:05 Inactive
Copy link
Contributor

@tmlayton tmlayton left a comment

Choose a reason for hiding this comment

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

Nitpick on the changelog entry, otherwise code and 🎩 looks good – thanks for adding this!

Co-Authored-By: BlazingBBQ <simon.cousineau99@gmail.com>
@ghost
Copy link

ghost commented Dec 18, 2018

🎉 Thanks for your contribution to Polaris React!

@blazingbbq blazingbbq deleted the actionlist-helptext branch December 18, 2018 18:34
@danrosenthal danrosenthal temporarily deployed to production January 7, 2019 14:27 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.

5 participants