refactor button: add type prop and auto-disable on click#62
Conversation
✅ Deploy Preview for pharmatech ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
@andres15alvarez este archivo creo que hay que eliminarlo, my bad
There was a problem hiding this comment.
si opino igual, los comentarios también.
| className?: string; | ||
| variant?: 'submit' | 'white' | 'light' | 'icon' | 'gray'; | ||
| textColor?: string; | ||
| type?: 'submit' | 'reset' | 'button' | undefined; |
There was a problem hiding this comment.
Aca si es opcional el :? toma como que puede recibirse o no, creo que no hay que pasarle en si que tomara un tipo undefined, ya que es opcional de tomar alguno ya recibe una de las variantes.
There was a problem hiding this comment.
Aca si es opcional el :? toma como que puede recibirse o no, creo que no hay que pasarle en si que tomara un tipo undefined, ya que es opcional de tomar alguno ya recibe una de las variantes.
¿Te refieres a que debería estar así type?: 'submit' | 'reset' | 'button';?
|
No tendremos tiempo para implementar esta nueva funcionalidad en todos los botones, por tanto se cierra el PR |
🔧 Refactor: Button Component
✅ Summary
This Pull Request refactors the
Buttoncomponent to add more flexibility and reliability without introducing any breaking changes.✨ What's New
➕ Added
typepropSupports
"button","submit", and"reset".This prop is optional.
When omitted, the native HTML behavior applies (
submitinside a<form>).To prevent unwanted form submissions, explicitly use:
type="button"for non-submitting buttonstype="submit"for form submissions🔄 Internal
internalDisabledhandlingonClickfunction returns a Promise, the button stays disabled until it resolves or rejects.🛡 Compatibility
Buttoncomponent.