globalbrain / sefirot

Global Brain Design System.
https://sefirot.globalbrains.com
MIT License
150 stars 12 forks source link

feat(login-page): add password action #543

Closed kiaking closed 4 months ago

kiaking commented 4 months ago

Add password action to the <SLoginPage>.

It will also show email/password dialog and handle validations. We can await inside onSubmit function to show loading spinner on the form.

const actions = [
  {
    type: 'password',
    async onSubmit(email, password) {
      // The email/password dialog will show loading spinner
      // while this promise is being awaited
      await login(email, password)
    }
  }
]

Screenshot 2024-07-18 at 13 20 42 Screenshot 2024-07-18 at 13 20 49
netlify[bot] commented 4 months ago

Deploy Preview for sefirot-story ready!

Name Link
Latest commit b53db2fbd381996c0ec0807c63a3235c4a55a422
Latest deploy log https://app.netlify.com/sites/sefirot-story/deploys/6698a1e138ad4400084a421c
Deploy Preview https://deploy-preview-543--sefirot-story.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] commented 4 months ago

Deploy Preview for sefirot-docs ready!

Name Link
Latest commit b53db2fbd381996c0ec0807c63a3235c4a55a422
Latest deploy log https://app.netlify.com/sites/sefirot-docs/deploys/6698a1e1df84ed00081e34b6
Deploy Preview https://deploy-preview-543--sefirot-docs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

kiaking commented 4 months ago

Oh wait, forgot to implement error messaging feature when login failed. Gonna add it. Hmmm... return false in onSubmit and display error I guess.

kiaking commented 4 months ago

@brc-dd Added error feature.

const actions = [
  {
    type: 'password',
    onSubmit(email, password) {
      // Show error if it returns false.
      return login(email, password)
    }
  }
]