Skip to content

Conversation

@kyledurand
Copy link
Member

@kyledurand kyledurand commented Jul 26, 2021

WHY are these changes introduced?

Fixes #3967

How to 🎩

Copy-paste this code in playground/Playground.tsx:
import React from 'react';

import {Banner, Button, Page} from '../src';

export function Playground() {
  const [loading, setLoading] = React.useState(true);
  React.useEffect(() => {
    setTimeout(() => {
      setLoading(!loading);
    }, 1000);
  });

  return (
    <Page title="Playground">
      <Banner
        title="Some of your product variants are missing weights"
        status="warning"
        action={{content: 'Edit variant weights', loading}}
        secondaryAction={{content: 'Learn more', url: ''}}
        onDismiss={() => {}}
      >
        <p>
          Add weights to show accurate rates at checkout and when buying
          shipping labels in Shopify.
        </p>
      </Banner>
      <Button loading={loading}>Some text</Button>
      <Banner
        title="Some of your product variants are missing weights"
        status="critical"
        action={{
          content:
            'Edit variant weights with an extremely long title that wraps at small screens',
          loading,
        }}
        secondaryAction={{content: 'Learn more', url: ''}}
        onDismiss={() => {}}
      >
        <p>
          Add weights to show accurate rates at checkout and when buying
          shipping labels in Shopify.
        </p>
      </Banner>
      <Banner
        title="Some of your product variants are missing weights"
        status="info"
        action={{content: 'Edit variant weights', loading}}
        secondaryAction={{content: 'Learn more', url: ''}}
        onDismiss={() => {}}
      >
        <p>
          Add weights to show accurate rates at checkout and when buying
          shipping labels in Shopify.
        </p>
      </Banner>
      <Banner
        title="Some of your product variants are missing weights"
        status="success"
        action={{content: 'Edit variant weights', loading}}
        secondaryAction={{content: 'Learn more', url: ''}}
        onDismiss={() => {}}
      >
        <p>
          Add weights to show accurate rates at checkout and when buying
          shipping labels in Shopify.
        </p>
      </Banner>
      <Banner
        title="Some of your product variants are missing weights"
        status="info"
        action={{content: 'Edit variant weights', loading}}
        secondaryAction={{content: 'Learn more', url: ''}}
        onDismiss={() => {}}
      >
        <p>
          Add weights to show accurate rates at checkout and when buying
          shipping labels in Shopify.
        </p>
      </Banner>
      <Banner
        title="Some of your product variants are missing weights"
        action={{content: 'Edit variant weights', loading}}
        secondaryAction={{content: 'Learn more', url: ''}}
        onDismiss={() => {}}
      >
        <p>
          Add weights to show accurate rates at checkout and when buying
          shipping labels in Shopify.
        </p>
      </Banner>
    </Page>
  );
}

🎩 checklist

@kyledurand kyledurand self-assigned this Jul 26, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jul 26, 2021

size-limit report

Path Size
cjs 142.2 KB (+0.06% 🔺)
esm 95.93 KB (+0.09% 🔺)
esnext 138.96 KB (+0.08% 🔺)
css 33.58 KB (+0.06% 🔺)

@kyledurand kyledurand marked this pull request as ready for review July 27, 2021 15:07
Copy link

@sergical sergical left a comment

Choose a reason for hiding this comment

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

❤️

@kyledurand kyledurand merged commit fceb952 into main Jul 29, 2021
@kyledurand kyledurand deleted the banner_add-loading-state-to-primary-action branch July 29, 2021 16:15
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.

Banner action loading state is broken (?)

2 participants