index.tsx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import type { FC } from 'react'
  2. import {
  3. Csv,
  4. Doc,
  5. Docx,
  6. Html,
  7. Json,
  8. Md,
  9. Pdf,
  10. Txt,
  11. Unknown,
  12. Xlsx,
  13. } from '@/app/components/base/icons/src/public/files'
  14. import { Notion } from '@/app/components/base/icons/src/public/common'
  15. type FileIconProps = {
  16. type: string
  17. className?: string
  18. }
  19. const FileIcon: FC<FileIconProps> = ({
  20. type,
  21. className,
  22. }) => {
  23. switch (type) {
  24. case 'csv':
  25. return <Csv className={className} />
  26. case 'doc':
  27. return <Doc className={className} />
  28. case 'docx':
  29. return <Docx className={className} />
  30. case 'htm':
  31. case 'html':
  32. return <Html className={className} />
  33. case 'json':
  34. return <Json className={className} />
  35. case 'md':
  36. case 'markdown':
  37. return <Md className={className} />
  38. case 'pdf':
  39. return <Pdf className={className} />
  40. case 'txt':
  41. return <Txt className={className} />
  42. case 'xls':
  43. case 'xlsx':
  44. return <Xlsx className={className} />
  45. case 'notion':
  46. return <Notion className={className} />
  47. default:
  48. return <Unknown className={className} />
  49. }
  50. }
  51. export default FileIcon