Skip to content

Commit

Permalink
feat(mellow-react): add InputButton
Browse files Browse the repository at this point in the history
  • Loading branch information
DominusKelvin committed Sep 20, 2024
1 parent 2a19c59 commit e098abf
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions templates/mellow-react/assets/js/components/InputButton.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
export default function InputButton({ processing, ...props }) {
return (
<button
type="submit"
className="relative flex items-center justify-center rounded-md border border-brand bg-brand px-4 py-3 text-white disabled:cursor-not-allowed disabled:border-gray-200/40 disabled:bg-gray-200/40 disabled:text-gray"
{...props}
>
{processing && (
<svg
className="absolute h-5 w-5 animate-spin text-white"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
>
<circle
className="opacity-25"
cx="12"
cy="12"
r="10"
stroke="currentColor"
strokeWidth="4"
></circle>
<path
className="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
></path>
</svg>
)}
<span className={processing && 'invisible'}>
<slot>Submit</slot>
</span>
</button>
)
}

0 comments on commit e098abf

Please sign in to comment.