mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-26 07:25:27 +08:00
35 lines
876 B
TypeScript
35 lines
876 B
TypeScript
import { Box, Dialog, DialogContent, DialogTitle } from '@mui/material'
|
|
import { QRCodeSVG } from 'qrcode.react'
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
interface Props {
|
|
open: boolean
|
|
value: string
|
|
title?: string
|
|
onClose: () => void
|
|
}
|
|
|
|
export const QrViewer = (props: Props) => {
|
|
const { open, value, title, onClose } = props
|
|
const { t } = useTranslation()
|
|
|
|
return (
|
|
<Dialog open={open} onClose={onClose} maxWidth="xs">
|
|
<DialogTitle>{title ?? t('profiles.modals.qrViewer.title')}</DialogTitle>
|
|
<DialogContent sx={{ pb: 3 }}>
|
|
<Box
|
|
sx={{
|
|
display: 'flex',
|
|
justifyContent: 'center',
|
|
p: 2,
|
|
bgcolor: '#fff',
|
|
borderRadius: 1,
|
|
}}
|
|
>
|
|
<QRCodeSVG value={value} size={256} level="M" />
|
|
</Box>
|
|
</DialogContent>
|
|
</Dialog>
|
|
)
|
|
}
|