perf: btn color (#423)

This commit is contained in:
Archer
2023-10-24 13:19:23 +08:00
committed by GitHub
parent bf6dbfb245
commit 1942cb0d67
41 changed files with 350 additions and 221 deletions

View File

@@ -11,9 +11,13 @@ import {
} from '@chakra-ui/react';
import { useTranslation } from 'next-i18next';
export const useConfirm = (props: { title?: string | null; content?: string | null }) => {
export const useConfirm = (props: {
title?: string | null;
content?: string | null;
bg?: string;
}) => {
const { t } = useTranslation();
const { title = t('Warning'), content } = props;
const { title = t('Warning'), content, bg } = props;
const [customContent, setCustomContent] = useState(content);
const { isOpen, onOpen, onClose } = useDisclosure();
@@ -61,6 +65,7 @@ export const useConfirm = (props: { title?: string | null; content?: string | nu
{t('Cancel')}
</Button>
<Button
{...(bg && { bg: `${bg} !important` })}
ml={4}
onClick={() => {
onClose();
@@ -74,7 +79,7 @@ export const useConfirm = (props: { title?: string | null; content?: string | nu
</AlertDialogOverlay>
</AlertDialog>
),
[customContent, isOpen, onClose, t, title]
[bg, customContent, isOpen, onClose, t, title]
)
};
};