Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Card] Add full example to styleguide #939

Merged
merged 1 commit into from
Feb 12, 2019
Merged

[Card] Add full example to styleguide #939

merged 1 commit into from
Feb 12, 2019

Conversation

elileto
Copy link
Contributor

@elileto elileto commented Jan 28, 2019

WHY are these changes introduced?

Resolves #890

WHAT is this pull request doing?

Adds an example to the styleguide that includes a combination of all the props available for Card.

image

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

interface State {}

export default class Playground extends React.Component<never, State> {
  render() {
    return (
      <Card
        secondaryFooterAction={{content: 'Dismiss'}}
        primaryFooterAction={{content: 'Export Report'}}
      >
        <Card.Header
          actions={[
            {
              content: 'Total Sales',
            },
          ]}
          title="Sales"
        >
          <Popover
            active={false}
            activator={
              <Button disclosure plain>
                View Sales
              </Button>
            }
            onClose={() => {}}
          >
            <ActionList
              items={[{content: 'Gross Sales'}, {content: 'Net Sales'}]}
            />
          </Popover>
        </Card.Header>
        <Card.Section>
          <TextContainer>
            You can use sales reports to see information about your customers'
            orders based on criteria such as sales over time, by channel, or by
            staff.
          </TextContainer>
        </Card.Section>
        <Card.Section title="Total Sales Breakdown">
          <ResourceList
            resourceName={{singular: 'sale', plural: 'sales'}}
            items={[
              {
                sales: 'Orders',
                amount: 'USD$0.00',
                url: 'reports/orders',
              },
              {
                sales: 'Returns',
                amount: '-USD$250.00',
                url: 'reports/returns',
              },
            ]}
            renderItem={(item) => {
              const {sales, amount, url} = item;
              return (
                <ResourceList.Item
                  url={url}
                  accessibilityLabel={`View Sales for ${sales}`}
                >
                  <Stack>
                    <Stack.Item fill>{sales}</Stack.Item>
                    <Stack.Item>{amount}</Stack.Item>
                  </Stack>
                </ResourceList.Item>
              );
            }}
          />
        </Card.Section>
        <Card.Section title="Deactivated reports" subdued>
          <List>
            <List.Item>Payouts</List.Item>
            <List.Item>Total Sales By Channel</List.Item>
          </List>
        </Card.Section>
        <Card.Section title="Note">
          <TextContainer>
            The sales reports are available only if your store is on the Shopify
            plan or higher.
          </TextContainer>
        </Card.Section>
      </Card>
    );
  }
}

🎩 checklist

@elileto elileto self-assigned this Jan 28, 2019
@BPScott BPScott temporarily deployed to polaris-react-pr-939 January 28, 2019 19:42 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-939 January 28, 2019 20:03 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-939 January 28, 2019 20:06 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-939 January 28, 2019 20:07 Inactive
Copy link
Contributor

@ry5n ry5n left a comment

Choose a reason for hiding this comment

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

I like this, but it combines some props that aren’t intended to be combined. Also, DataTable doesn’t look great in this context; consider some other content for the sections.

@BPScott BPScott temporarily deployed to polaris-react-pr-939 February 1, 2019 16:08 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-939 February 1, 2019 21:03 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-939 February 1, 2019 21:04 Inactive
Copy link
Contributor

@ry5n ry5n left a comment

Choose a reason for hiding this comment

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

Two things, otherwise looking good 😃

@BPScott BPScott temporarily deployed to polaris-react-pr-939 February 1, 2019 21:55 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-939 February 4, 2019 18:00 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-939 February 6, 2019 21:19 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-939 February 6, 2019 21:21 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-939 February 11, 2019 18:12 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-939 February 11, 2019 18:39 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-939 February 11, 2019 21:17 Inactive
@elileto elileto removed the Blocked label Feb 11, 2019
@BPScott BPScott temporarily deployed to polaris-react-pr-939 February 11, 2019 21:31 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-939 February 11, 2019 21:32 Inactive
@elileto elileto changed the title [WIP][Card] Add full example to styleguide [Card] Add full example to styleguide Feb 11, 2019
@elileto elileto requested a review from yourpalsonja February 12, 2019 01:49
@BPScott BPScott requested a deployment to polaris-react-pr-939 February 12, 2019 22:24 Abandoned
@elileto elileto merged commit 1ab94d2 into master Feb 12, 2019
@elileto elileto deleted the card-kitchen-sink branch February 12, 2019 22:29
@alex-page alex-page temporarily deployed to production February 20, 2019 15:24 Inactive
@alex-page alex-page temporarily deployed to production February 20, 2019 15:31 Inactive
@alex-page alex-page temporarily deployed to production February 20, 2019 15:40 Inactive
@alex-page alex-page temporarily deployed to production February 20, 2019 15:45 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.

6 participants