Skip to content
This repository has been archived by the owner on Oct 20, 2021. It is now read-only.

[Button] Add loading button #61

Closed
3 tasks done
Kimi-Gao opened this issue Sep 3, 2019 · 0 comments
Closed
3 tasks done

[Button] Add loading button #61

Kimi-Gao opened this issue Sep 3, 2019 · 0 comments
Assignees

Comments

@Kimi-Gao
Copy link
Member

Kimi-Gao commented Sep 3, 2019

Loading Button

Assign the loading attribute to a button to initialize a spinner.

Cases

  • async function/api
  • long time to be finished

Render

loading-button

  • Animation lasts about 3 seconds
  • Click event will be invalid when button is loading

Code

@keyframes move-progress-bar {
    0% {
        background-position: 0 0
    }
    100% {
        background-position: 40px 40px
    }
}
:after {
    content: '';
    background-size: 40px 40px;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-image: linear-gradient(-45deg,hsla(198,20%,83%,.65) 25%,hsla(200,21%,92%,.65) 25%,hsla(200,21%,92%,.65) 50%,hsla(198,20%,83%,.65) 50%,hsla(198,20%,83%,.65) 75%,hsla(200,21%,92%,.65) 75%,hsla(200,21%,92%,.65));
    animation: move-progress-bar 1s linear infinite;
    margin: 10px
}

Usage

import Button from 'earth-ui/lib/Button';
import { useState } from 'react';

const LoadingButton = () => {
    const [loading, setLoading] = useState(false);
    return <Button type="primary" loading={loading} onClick={() => setLoading(true)} />;
}

Others

  • test coverage > 90%
@Kimi-Gao Kimi-Gao added this to the earth-ui@0.6.x milestone Sep 14, 2019
@Kimi-Gao Kimi-Gao self-assigned this Sep 20, 2019
@Kimi-Gao Kimi-Gao added this to To do in earth-ui@0.6.x via automation Sep 20, 2019
@Kimi-Gao Kimi-Gao moved this from To do to Reviewing in earth-ui@0.6.x Sep 20, 2019
earth-ui@0.6.x automation moved this from Reviewing to Done Sep 20, 2019
@Kimi-Gao Kimi-Gao removed this from Done in earth-ui@0.6.x Sep 20, 2019
@Kimi-Gao Kimi-Gao added this to issues: Done in earth-ui@0.6.x Sep 20, 2019
Kimi-Gao added a commit that referenced this issue Sep 30, 2019
…#76)

* feat(button): add loading attribute to button to initialize a spinner

re #61

* add micro loading button

* remove handleClick from button
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
earth-ui@0.6.x
  
Done (issues)
Development

No branches or pull requests

1 participant