feat: chat ui

This commit is contained in:
archer
2023-07-26 11:01:25 +08:00
parent 2b993b926a
commit 248be38939
19 changed files with 153 additions and 54 deletions

View File

@@ -9,8 +9,11 @@ import {
useDisclosure,
Button
} from '@chakra-ui/react';
import { useTranslation } from 'next-i18next';
export const useConfirm = ({ title = 'Warning', content }: { title?: string; content: string }) => {
const { t } = useTranslation();
export const useConfirm = ({ title = '提示', content }: { title?: string; content: string }) => {
const { isOpen, onOpen, onClose } = useDisclosure();
const cancelRef = useRef(null);
const confirmCb = useRef<any>();
@@ -32,7 +35,7 @@ export const useConfirm = ({ title = '提示', content }: { title?: string; cont
<AlertDialogOverlay>
<AlertDialogContent maxW={'min(90vw,400px)'}>
<AlertDialogHeader fontSize="lg" fontWeight="bold">
{title}
{t(title)}
</AlertDialogHeader>
<AlertDialogBody>{content}</AlertDialogBody>
@@ -45,7 +48,7 @@ export const useConfirm = ({ title = '提示', content }: { title?: string; cont
typeof cancelCb.current === 'function' && cancelCb.current();
}}
>
{t('Cancel')}
</Button>
<Button
ml={4}
@@ -54,7 +57,7 @@ export const useConfirm = ({ title = '提示', content }: { title?: string; cont
typeof confirmCb.current === 'function' && confirmCb.current();
}}
>
{t('Confirm')}
</Button>
</AlertDialogFooter>
</AlertDialogContent>