mirror of
https://git.um-react.app/um/um-react.git
synced 2025-11-28 03:23:02 +00:00
feat: add insturctions on how to dump keys for v10
This commit is contained in:
32
src/components/DownloadBase64.tsx
Normal file
32
src/components/DownloadBase64.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { ExtLink } from './ExtLink';
|
||||
import { IoMdArchive } from 'react-icons/io';
|
||||
|
||||
export type DownloadBase64Props = {
|
||||
data: string;
|
||||
filename: string;
|
||||
mimetype?: string;
|
||||
className?: string;
|
||||
icon?: boolean | ReactNode;
|
||||
children?: ReactNode;
|
||||
};
|
||||
|
||||
export function DownloadBase64({
|
||||
className,
|
||||
children,
|
||||
data,
|
||||
filename,
|
||||
icon,
|
||||
mimetype = 'application/octet-stream',
|
||||
}: DownloadBase64Props) {
|
||||
return (
|
||||
<ExtLink
|
||||
icon={icon ?? <IoMdArchive className="inline size-sm ml-1" />}
|
||||
className={className ?? 'link-info mx-1'}
|
||||
download={filename}
|
||||
href={`data:${mimetype};base64,${data}`}
|
||||
>
|
||||
{children ?? <code>{filename}</code>}
|
||||
</ExtLink>
|
||||
);
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
import type { AnchorHTMLAttributes } from 'react';
|
||||
import type { AnchorHTMLAttributes, ReactNode } from 'react';
|
||||
import { FiExternalLink } from 'react-icons/fi';
|
||||
|
||||
export type ExtLinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
|
||||
icon?: boolean;
|
||||
icon?: boolean | ReactNode;
|
||||
};
|
||||
|
||||
export function ExtLink({ className, icon = true, children, ...props }: ExtLinkProps) {
|
||||
return (
|
||||
<a rel="noreferrer noopener nofollow" target="_blank" className={`link ${className}`} {...props}>
|
||||
{children}
|
||||
{icon && <FiExternalLink className="inline size-sm ml-1" />}
|
||||
{icon === true ? <FiExternalLink className="inline size-sm ml-1" /> : icon}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
|
||||
import { FileInput } from '~/components/FileInput';
|
||||
import { InSecretImportModalContext } from '~/context/InSecretImportModal';
|
||||
|
||||
export interface ImportSecretModalProps {
|
||||
clientName?: React.ReactNode;
|
||||
@@ -31,7 +32,7 @@ export function ImportSecretModal({ clientName, children, show, onClose, onImpor
|
||||
}, [show]);
|
||||
|
||||
return (
|
||||
<dialog ref={refModel} className="modal">
|
||||
<dialog ref={refModel} className="modal" onClose={onClose}>
|
||||
<div className="modal-box">
|
||||
<form method="dialog" onSubmit={() => onClose()}>
|
||||
<button className="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</button>
|
||||
@@ -41,7 +42,9 @@ export function ImportSecretModal({ clientName, children, show, onClose, onImpor
|
||||
<FileInput onReceiveFiles={handleFileReceived}>拖放或点我选择含有密钥的数据库文件</FileInput>
|
||||
|
||||
<div className="mt-2">选择你的{clientName && <>「{clientName}」</>}客户端平台以查看对应说明:</div>
|
||||
<div>{children}</div>
|
||||
<InSecretImportModalContext.Provider value={true}>
|
||||
<div>{children}</div>
|
||||
</InSecretImportModalContext.Provider>
|
||||
</div>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
Reference in New Issue
Block a user