mazipan / tanyaaja.in

❓Kumpulkan pertanyaan secara anonim dari siapa saja dengan mudah
https://tanyaaja.in
MIT License
138 stars 38 forks source link

Add Loader Icon in all buttons while submitting #44

Closed mazipan closed 1 year ago

mazipan commented 1 year ago

Currently I just disable the button, it will be nice if we can improve by adding the loader also.

Based on #43, you can use Loader using icon and combined with css animate from tailwind:

e.g: <Loader2 className="animate-spin" />

For example code like this:

<Button type="submit" disabled={isLoading}>
  <PaperPlaneIcon className="mr-2 h-4 w-4" />
  {isLoading ? 'Sedang mengirim...' : 'Kirim pertanyaan'}
</Button>

It better if we do like this:

<Button type="submit" disabled={isLoading}>
  {isLoading ? (
   <>
     <Loader2 className="mr-2 h-4 w-4 animate-spin" />
     <span>Sedang mengirim...</span>
   </>
  ) : (
   <>
     <PaperPlaneIcon className="mr-2 h-4 w-4" />
     <span>Kirim pertanyaan</span>
   </>
  )}
</Button>
mohiwalla commented 1 year ago

Hi @mazipan, Do I need to get it assigned first OR shall I raise my PR directly.?

mazipan commented 1 year ago

No need, but if you want, just create a draft PR first to reserve the ticket