Skip to content

Conversation

@helloneele
Copy link
Contributor

@helloneele helloneele commented Feb 14, 2019

WHY are these changes introduced?

Resolves #1039

I chose 3 size options for now, because in the issues screenshot the thumbnails seem to have a size of 30px, not sure if it is accurate or scaled down, though. In the Home sidebar and on Home cards thumbnails have a size of 40px whereas in other sections of the admin (products) thumbnails have a size of 50px.

image

image

WHAT is this pull request doing?

Adds a new component that can be used for thumbnails while in loading state

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

Copy-paste this code in playground/Playground.tsx:
import React from 'react';
import {
  ActionList,
  AppProvider,
  Card,
  Frame,
  Layout,
  Navigation,
  Page,
  TopBar,
  SkeletonBodyText,
  SkeletonThumbnail,
  Stack,
} from '../src';

export default class FrameExample extends React.Component {
  defaultState = {
    emailFieldValue: 'dharma@jadedpixel.com',
    nameFieldValue: 'Jaded Pixel',
  };

  state = {
    searchActive: false,
    searchText: '',
    userMenuOpen: false,
    showMobileNavigation: false,
    storeName: this.defaultState.nameFieldValue,
  };

  render() {
    const {
      searchActive,
      searchText,
      userMenuOpen,
      showMobileNavigation,
      storeName,
    } = this.state;

    const userMenuActions = [
      {
        items: [{content: 'Community forums'}],
      },
    ];

    const navigationUserMenuMarkup = (
      <Navigation.UserMenu
        actions={userMenuActions}
        name="Dharma"
        detail={storeName}
        avatarInitials="D"
      />
    );

    const userMenuMarkup = (
      <TopBar.UserMenu
        actions={userMenuActions}
        name="Dharma"
        detail={storeName}
        initials="D"
        open={userMenuOpen}
      />
    );

    const searchResultsMarkup = (
      <Card>
        <ActionList
          items={[
            {content: 'Shopify help center'},
            {content: 'Community forums'},
          ]}
        />
      </Card>
    );

    const searchFieldMarkup = (
      <TopBar.SearchField value={searchText} placeholder="Search" />
    );

    const topBarMarkup = (
      <TopBar
        showNavigationToggle
        userMenu={userMenuMarkup}
        searchResultsVisible={searchActive}
        searchField={searchFieldMarkup}
        searchResults={searchResultsMarkup}
      />
    );

    const navigationMarkup = (
      <Navigation location="/" userMenu={navigationUserMenuMarkup}>
        <Navigation.Section
          items={[
            {
              label: 'Back to Shopify',
              icon: 'arrowLeft',
            },
          ]}
        />
        <Navigation.Section
          separator
          title="Jaded Pixel App"
          items={[
            {
              label: 'Dashboard',
              icon: 'home',
              onClick: undefined,
            },
            {
              label: 'Jaded Pixel Orders',
              icon: 'orders',
              onClick: undefined,
            },
          ]}
          action={{
            icon: 'conversation',
            accessibilityLabel: 'Contact support',
            onClick: undefined,
          }}
        />
      </Navigation>
    );

    const actualPageMarkup = (
      <Page title="Orders">
        <Layout>
          <Layout.AnnotatedSection
            title="Pending orders"
            description="Lorem ipsum dolor."
          >
            <Card>
              <Card.Section>
                <Stack wrap={false}>
                  <Stack.Item>
                    <SkeletonThumbnail size="large" />
                  </Stack.Item>
                  <Stack.Item fill>
                    <SkeletonBodyText lines={3} />
                  </Stack.Item>
                </Stack>
              </Card.Section>
              <Card.Section>
                <Stack wrap={false}>
                  <Stack.Item>
                    <SkeletonThumbnail size="large" />
                  </Stack.Item>
                  <Stack.Item fill>
                    <SkeletonBodyText lines={5} />
                  </Stack.Item>
                </Stack>
              </Card.Section>
            </Card>
<Card>
              <Card.Section>
                <Stack wrap={false}>
                  <Stack.Item>
                    <SkeletonThumbnail size="small" />
                  </Stack.Item>
                  <Stack.Item fill>
                    <SkeletonBodyText lines={2} />
                  </Stack.Item>
                </Stack>
              </Card.Section>
              <Card.Section>
                <Stack wrap={false}>
                  <Stack.Item>
                    <SkeletonThumbnail size="medium" />
                  </Stack.Item>
                  <Stack.Item fill>
                    <SkeletonBodyText lines={3} />
                  </Stack.Item>
                </Stack>
              </Card.Section>
              <Card.Section>
                <Stack wrap={false}>
                  <Stack.Item>
                    <SkeletonThumbnail size="large" />
                  </Stack.Item>
                  <Stack.Item fill>
                    <SkeletonBodyText lines={5} />
                  </Stack.Item>
                </Stack>
              </Card.Section>
            </Card>
          </Layout.AnnotatedSection>
        </Layout>
      </Page>
    );

    const theme = {
      colors: {
        topBar: {
          background: '#357997',
        },
      },
      logo: {
        width: 124,
        topBarSource:
          'https://cdn.shopify.com/s/files/1/0446/6937/files/jaded-pixel-logo-color.svg?6215648040070010999',
        contextualSaveBarSource:
          'https://cdn.shopify.com/s/files/1/0446/6937/files/jaded-pixel-logo-gray.svg?6215648040070010999',
        url: 'http://jadedpixel.com',
        accessibilityLabel: 'Jaded Pixel',
      },
    };

    return (
      <div style={{height: '500px'}}>
        <AppProvider theme={theme}>
          <Frame
            topBar={topBarMarkup}
            navigation={navigationMarkup}
            showMobileNavigation={showMobileNavigation}
          >
            {actualPageMarkup}
          </Frame>
        </AppProvider>
      </div>
    );
  }
}

🎩 checklist

@BPScott BPScott temporarily deployed to polaris-react-pr-1041 February 14, 2019 19:20 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-1041 February 14, 2019 20:11 Inactive
@helloneele helloneele requested a review from chloerice February 14, 2019 20:33
Copy link
Member

@chloerice chloerice left a comment

Choose a reason for hiding this comment

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

Code looks excellent!! Thank you so much for taking this on 🙌


### New components

- `SkeletonThumbnail` for representing thumbnails in loading state
Copy link
Member

Choose a reason for hiding this comment

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

🙌

Co-Authored-By: helloneele <helloneele@users.noreply.github.com>
@BPScott BPScott temporarily deployed to polaris-react-pr-1041 February 15, 2019 14:15 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-1041 February 15, 2019 14:37 Inactive
@allyshiasewdat
Copy link
Contributor

Thanks so much for getting to this so quickly!

Copy link
Contributor

@elileto elileto left a comment

Choose a reason for hiding this comment

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

💯

@helloneele helloneele merged commit 93c3e0f into master Feb 19, 2019
@helloneele helloneele deleted the skeleton-thumbnail branch February 19, 2019 17:31
solonaarmstrong-zz pushed a commit that referenced this pull request Feb 20, 2019
* [Skeleton] Add skeleton for thumbnails

* Update src/components/SkeletonThumbnail/README.md

Co-Authored-By: helloneele <helloneele@users.noreply.github.com>

* update version in README.md

* update README.md
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.

Request for avatar-shaped Skeleton

5 participants