Skip to content

Conversation

chloerice
Copy link
Member

WHY are these changes introduced?

Fixes #1135

WHAT is this pull request doing?

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

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

interface State {
  loading: boolean;
}

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

  toggleLoadingState = () => {
    this.setState(({loading}) => ({loading: !loading}));
  };

  render() {
    const {loading} = this.state;
    const source =
      'https://www.usmagazine.com/wp-content/uploads/2018/06/Smoothie-the-Cat-Instagram-zoom.jpg';

    const thumbnailMarkup = loading ? (
      <Stack vertical>
        <SkeletonThumbnail size="small" />
        <SkeletonThumbnail size="medium" />
        <SkeletonThumbnail size="large" />
      </Stack>
    ) : (
      <Stack vertical>
        <Thumbnail source={source} size="small" alt="Fluffy orange cat" />
        <Thumbnail source={source} size="medium" alt="Fluffy orange cat" />
        <Thumbnail source={source} size="large" alt="Fluffy orange cat" />
      </Stack>
    );

    return (
      <Page title="Playground">
        <Card
          sectioned
          actions={[
            {
              content: 'Toggle loading state',
              onAction: this.toggleLoadingState,
            },
          ]}
        >
          {thumbnailMarkup}
        </Card>
      </Page>
    );
  }
}

🎩 checklist

@chloerice chloerice requested a review from AndrewMusgrave March 7, 2019 18:00
@BPScott BPScott temporarily deployed to polaris-react-pr-1141 March 7, 2019 18:00 Inactive
@chloerice chloerice force-pushed the skeleton-thumbnail-sizing branch from a07bb53 to 7b1a138 Compare March 7, 2019 18:05
@BPScott BPScott temporarily deployed to polaris-react-pr-1141 March 7, 2019 18:05 Inactive

.sizeLarge {
@include skeleton-thumbnail-size(rem(50px));
@include skeleton-thumbnail-size(rem(80px));
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way to import these from the actual Thumbnail component? Otherwise they're going to get out of sync again next time something changes

Copy link
Member

Choose a reason for hiding this comment

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

Maybe a simple function? thumbnailSize(small)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done! Let me know what y'all think 😀

Copy link
Contributor

@amrocha amrocha left a comment

Choose a reason for hiding this comment

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

:woo:

@chloerice chloerice merged commit 3fdbf0b into master Mar 7, 2019
@chloerice chloerice deleted the skeleton-thumbnail-sizing branch March 7, 2019 19:43
@amrocha amrocha temporarily deployed to production March 7, 2019 22:06 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