Add new translations and update existing ones

This commit is contained in:
n4ze3m
2024-03-24 14:38:37 +05:30
parent 9a2adbd859
commit d9ce1e2d2c
8 changed files with 116 additions and 37 deletions

View File

@@ -1,5 +1,6 @@
import { useState } from "react"
import { CheckIcon } from "lucide-react"
import { useTranslation } from "react-i18next"
type Props = {
onClick?: () => void
disabled?: boolean
@@ -13,11 +14,12 @@ export const SaveButton = ({
onClick,
disabled,
className,
text = "Save",
textOnSave = "Saved",
text = "save",
textOnSave = "saved",
btnType = "button"
}: Props) => {
const [clickedSave, setClickedSave] = useState(false)
const { t } = useTranslation("common")
return (
<button
type={btnType}
@@ -33,7 +35,7 @@ export const SaveButton = ({
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}
{clickedSave ? t(textOnSave) : t(text)}
</button>
)
}