harshmangalam / hydrogen-solidjs-client

A social media web app powered by SolidJS
GNU General Public License v3.0
82 stars 61 forks source link

Implemented spinner in create button and disabled button #65

Closed Siddharth9890 closed 2 years ago

Siddharth9890 commented 2 years ago

Done with #46

vercel[bot] commented 2 years ago

Someone is attempting to deploy a commit to a Personal Account owned by @harshmangalam on Vercel.

@harshmangalam first needs to authorize it.

harshmangalam commented 2 years ago

Use classList instead of putting dynamic classes in className for better optimization

Siddharth9890 commented 2 years ago

Can you explain more about class list and how to use it because i have never heard of class list before @harshmangalam

harshmangalam commented 2 years ago

https://www.solidjs.com/tutorial/bindings_classlist

Siddharth9890 commented 2 years ago

image Like this @harshmangalam

harshmangalam commented 2 years ago

Yes but in place of class you will put classList like this

<button
disabled={loading()}
type="submit"
className="flex justify-center w-full s py-2 px-3 bg-blue-500 text-white rounded-lg text-lg"
classList={{"opacity-60":loading()}}>

<Show
  when={!loading()}
  fallback={<ImSpinner2 className="animate-spin w-8 h-8" />}>
  Create
</Show>
</button>
Siddharth9890 commented 2 years ago

Done @harshmangalam