mirror of
https://github.com/Awuqing/BackupX.git
synced 2026-08-28 11:37:04 +08:00
173 lines
4.3 KiB
TypeScript
173 lines
4.3 KiB
TypeScript
import type {ReactNode} from 'react';
|
|
|
|
export type DocIconName =
|
|
| 'arrowRight'
|
|
| 'bookOpen'
|
|
| 'box'
|
|
| 'check'
|
|
| 'clock'
|
|
| 'cloud'
|
|
| 'database'
|
|
| 'download'
|
|
| 'external'
|
|
| 'github'
|
|
| 'heart'
|
|
| 'monitor'
|
|
| 'network'
|
|
| 'restore'
|
|
| 'server'
|
|
| 'shield'
|
|
| 'storage'
|
|
| 'terminal'
|
|
| 'users'
|
|
| 'wrench';
|
|
|
|
type DocIconProps = {
|
|
name: DocIconName;
|
|
size?: number;
|
|
className?: string;
|
|
};
|
|
|
|
const ICON_PATHS: Record<Exclude<DocIconName, 'github'>, ReactNode> = {
|
|
arrowRight: (
|
|
<>
|
|
<path d="M5 12h14" />
|
|
<path d="m13 6 6 6-6 6" />
|
|
</>
|
|
),
|
|
bookOpen: (
|
|
<>
|
|
<path d="M3 5.5A3.5 3.5 0 0 1 6.5 2H11v17H6.5A3.5 3.5 0 0 0 3 22Z" />
|
|
<path d="M21 5.5A3.5 3.5 0 0 0 17.5 2H13v17h4.5A3.5 3.5 0 0 1 21 22Z" />
|
|
</>
|
|
),
|
|
box: (
|
|
<>
|
|
<path d="m12 3 8 4.5v9L12 21l-8-4.5v-9Z" />
|
|
<path d="m4.4 7.7 7.6 4.4 7.6-4.4" />
|
|
<path d="M12 12.1V21" />
|
|
</>
|
|
),
|
|
check: <path d="m5 12 4 4L19 6" />,
|
|
clock: (
|
|
<>
|
|
<circle cx="12" cy="12" r="9" />
|
|
<path d="M12 7v5l3 2" />
|
|
</>
|
|
),
|
|
cloud: <path d="M17.5 19H7a5 5 0 0 1-.6-9.96A6.5 6.5 0 0 1 18.7 8.2 5.5 5.5 0 0 1 17.5 19Z" />,
|
|
database: (
|
|
<>
|
|
<ellipse cx="12" cy="5" rx="8" ry="3" />
|
|
<path d="M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5" />
|
|
<path d="M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6" />
|
|
</>
|
|
),
|
|
download: (
|
|
<>
|
|
<path d="M12 3v12" />
|
|
<path d="m7 10 5 5 5-5" />
|
|
<path d="M4 20h16" />
|
|
</>
|
|
),
|
|
external: (
|
|
<>
|
|
<path d="M14 4h6v6" />
|
|
<path d="m20 4-9 9" />
|
|
<path d="M19 13v6a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h6" />
|
|
</>
|
|
),
|
|
heart: <path d="M20.8 4.6a5.5 5.5 0 0 0-7.8 0L12 5.7l-1.1-1.1a5.5 5.5 0 0 0-7.8 7.8l1.1 1.1L12 21l7.8-7.5 1.1-1.1a5.5 5.5 0 0 0-.1-7.8Z" />,
|
|
monitor: (
|
|
<>
|
|
<rect x="3" y="4" width="18" height="13" rx="1" />
|
|
<path d="M8 21h8" />
|
|
<path d="M12 17v4" />
|
|
</>
|
|
),
|
|
network: (
|
|
<>
|
|
<rect x="9" y="3" width="6" height="5" rx="1" />
|
|
<rect x="3" y="16" width="6" height="5" rx="1" />
|
|
<rect x="15" y="16" width="6" height="5" rx="1" />
|
|
<path d="M12 8v4M6 16v-4h12v4" />
|
|
</>
|
|
),
|
|
restore: (
|
|
<>
|
|
<path d="M4 7v5h5" />
|
|
<path d="M5.6 17a8 8 0 1 0 .4-10L4 9" />
|
|
<path d="M12 8v4l3 2" />
|
|
</>
|
|
),
|
|
server: (
|
|
<>
|
|
<rect x="3" y="4" width="18" height="6" rx="1" />
|
|
<rect x="3" y="14" width="18" height="6" rx="1" />
|
|
<path d="M7 7h.01M7 17h.01M11 7h7M11 17h7" />
|
|
</>
|
|
),
|
|
shield: (
|
|
<>
|
|
<path d="M12 3 20 6v6c0 5-3.3 8.2-8 9-4.7-.8-8-4-8-9V6Z" />
|
|
<path d="m8.5 12 2.2 2.2 4.8-5" />
|
|
</>
|
|
),
|
|
storage: (
|
|
<>
|
|
<path d="M4 6h16v12H4z" />
|
|
<path d="M8 10h8M8 14h5" />
|
|
</>
|
|
),
|
|
terminal: (
|
|
<>
|
|
<rect x="3" y="4" width="18" height="16" rx="1" />
|
|
<path d="m7 9 3 3-3 3M13 15h4" />
|
|
</>
|
|
),
|
|
users: (
|
|
<>
|
|
<circle cx="9" cy="8" r="3" />
|
|
<path d="M3 20a6 6 0 0 1 12 0" />
|
|
<path d="M16 5.2a3 3 0 0 1 0 5.6M17 14a5 5 0 0 1 4 4.9" />
|
|
</>
|
|
),
|
|
wrench: (
|
|
<>
|
|
<path d="M14.7 6.3a4 4 0 0 0-5-5L12 3.6 8.4 7.2 6.1 4.9a4 4 0 0 0 5 5L19 17.8a1.6 1.6 0 0 1-2.2 2.2l-7.9-7.9" />
|
|
</>
|
|
),
|
|
};
|
|
|
|
export default function DocIcon({name, size = 20, className}: DocIconProps): ReactNode {
|
|
if (name === 'github') {
|
|
return (
|
|
<svg
|
|
aria-hidden="true"
|
|
className={className}
|
|
width={size}
|
|
height={size}
|
|
viewBox="0 0 24 24"
|
|
fill="currentColor">
|
|
<path d="M12 2C6.48 2 2 6.59 2 12.25c0 4.53 2.87 8.37 6.84 9.73.5.1.68-.22.68-.49v-1.92c-2.78.62-3.37-1.21-3.37-1.21-.45-1.18-1.11-1.49-1.11-1.49-.91-.64.07-.63.07-.63 1 .08 1.53 1.06 1.53 1.06.89 1.57 2.34 1.11 2.91.85.09-.67.35-1.11.63-1.37-2.22-.26-4.56-1.14-4.56-5.07 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.3.1-2.71 0 0 .84-.28 2.75 1.05A9.3 9.3 0 0 1 12 6.95a9.3 9.3 0 0 1 2.5.35c1.91-1.33 2.75-1.05 2.75-1.05.55 1.41.2 2.45.1 2.71.64.72 1.03 1.63 1.03 2.75 0 3.94-2.34 4.8-4.57 5.06.36.32.68.94.68 1.9v2.82c0 .27.18.59.69.49A10.27 10.27 0 0 0 22 12.25C22 6.59 17.52 2 12 2Z" />
|
|
</svg>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<svg
|
|
aria-hidden="true"
|
|
className={className}
|
|
width={size}
|
|
height={size}
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
strokeWidth="1.6"
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round">
|
|
{ICON_PATHS[name]}
|
|
</svg>
|
|
);
|
|
}
|