Fix dropdown filter bug and add save button animation

This commit is contained in:
n4ze3m
2024-02-25 23:45:07 +05:30
parent 094615498c
commit 03db4631d7
7 changed files with 272 additions and 85 deletions

View File

@@ -1,5 +1,5 @@
import { useState } from "react"
import { CheckIcon } from "lucide-react"
type Props = {
onClick?: () => void
disabled?: boolean
@@ -23,13 +23,16 @@ export const SaveButton = ({
type={btnType}
onClick={() => {
setClickedSave(true)
onClick()
if (onClick) {
onClick()
}
setTimeout(() => {
setClickedSave(false)
}, 1000)
}}
disabled={disabled}
className={`inline-flex mt-4 items-center rounded-md border border-transparent bg-black px-2 py-2 text-sm font-medium leading-4 text-white shadow-sm dark:bg-white dark:text-gray-800 disabled:opacity-50 ${className}`}>
{clickedSave ? <CheckIcon className="w-4 h-4 mr-2" /> : null}
{clickedSave ? textOnSave : text}
</button>
)