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

💡 Proposal - Progress/Loading state button #1621

Open
imshuffling opened this issue Dec 13, 2021 · 6 comments
Open

💡 Proposal - Progress/Loading state button #1621

imshuffling opened this issue Dec 13, 2021 · 6 comments
Labels
needs review Proposal/bug that needs to be reviewed by maintainers proposal stale Used to mark when there was no activity for a set period of time

Comments

@imshuffling
Copy link

imshuffling commented Dec 13, 2021

Forma 36 contribution proposal

Currently working on a custom app, where it has a button to create a new piece of content onClick.

When the onClick happens its field input data from microservices and other locations.

During this time I wanted to have a loading/progress state So I thought i would modify an

Screen.Recording.2021-12-10.at.09.19.05.mov

Some example code... I'm setting the progress bar with in state being bumped along inside an async function call (There's probably a better way to do this) :)

<div className="btn-container">
  <button className="btn-wrapper" onClick={createBrochure}>
    <div className="btn">
      Creating <Spinner color="white" />
    </div>
    <div className="progress" style={{ width: loadingBtn }}></div>
  </button>
</div>
.btn-container {
  position: relative;
  width: 148px;
}

.btn-wrapper {
  background-color: #036fe3;
  background-size: 100% 200%;
  border: .0625rem solid #036fe3;
  border-radius: 6px;
  box-shadow: 0 1px 0 rgba(25,37,50,.1);
  box-sizing: border-box;
  display: inline-block;
  font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
  font-size: .875rem;
  font-weight: 500;
  height: 2.5rem;
  overflow: hidden;
  padding: 0;
  text-decoration: none;
  transition: background .1s ease-in-out,opacity .2s ease-in-out,border-color .2s ease-in-out;
  vertical-align: middle;
  color: white;
  width: 100%;
  cursor: pointer;
}

.btn-wrapper .btn {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  line-height: 39px;
  text-align: center;
  z-index: 10;
  opacity: 1;
}

.btn-wrapper .progress {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  width: 50%;
  z-index: 5;
  background: #0059C8;
  border-radius: 6px;
  transition: width 2s ease-in-out;
}
@imshuffling imshuffling added needs review Proposal/bug that needs to be reviewed by maintainers proposal labels Dec 13, 2021
@imshuffling
Copy link
Author

Soo I'm proposing can we do something like this?

progress={width} can be a prop with a percentage value

So for example.
<Button buttonType="primary" isLoading={true} progress={width}>Create Brochure</Button>

@burakukula
Copy link
Contributor

Hey @imshuffling! Thanks a lot for bringing this topic! Great stuff! 👏
@fabe @domarku @damann how would you see this topic from a design perspective? Maybe you thought of some sort of progress bar already?

@damann
Copy link

damann commented Dec 14, 2021

I think it's great to have more distinguished ways of indicating ongoing processes.

I'd like to suggest a few usage guidelines:

If we (roughly) know the duration:
< 10 sec, use the bouncy dots loop

10 sec, use the percentage bar
For processes that take longer than 10 sec. show an estimate of when the process will be finished, ideally as time otherwise in percentage (design tbd @domarku I'd like to get your perspective here). If we don't know the duration, provide additional context alongside the progress indicator.

Another piece of advice – that we don't have a pattern for yet – is to allow processes to run in the background.

Don't mix dots and percentage bars (as in the video)

@imshuffling
Copy link
Author

Thanks @damann, some good thoughts. In my usecase because I'm relying on external microservices I wanted to show something a bit more than bouncy dots.. It can be around the 10sec mark :)

Another design idea i was thinking about is having an underline progress bar which maybe more subtle.

@damann
Copy link

damann commented Dec 14, 2021

@imshuffling I really liked your idea of the button filling up. I wanted to provide some guidance around how to choose one of the two options.

@github-actions
Copy link

github-actions bot commented Aug 9, 2022

Marking issue as stale since there was no acitivty for 30 days

@github-actions github-actions bot added the stale Used to mark when there was no activity for a set period of time label Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Proposal/bug that needs to be reviewed by maintainers proposal stale Used to mark when there was no activity for a set period of time
Projects
None yet
Development

No branches or pull requests

9 participants