|
1 | 1 | import type { SVGProps } from 'react' |
| 2 | +import { |
| 3 | + AudioIcon, |
| 4 | + ChartFileIcon, |
| 5 | + CsvIcon, |
| 6 | + DefaultFileIcon, |
| 7 | + DocxIcon, |
| 8 | + HtmlIcon, |
| 9 | + JsonIcon, |
| 10 | + MarkdownIcon, |
| 11 | + PdfIcon, |
| 12 | + PptxIcon, |
| 13 | + TxtIcon, |
| 14 | + VideoIcon, |
| 15 | + XlsxIcon, |
| 16 | + ZipIcon, |
| 17 | +} from '@sim/emcn/icons' |
2 | 18 | import { |
3 | 19 | SUPPORTED_ARCHIVE_EXTENSIONS, |
4 | 20 | SUPPORTED_ARCHIVE_MIME_TYPES, |
5 | 21 | SUPPORTED_AUDIO_EXTENSIONS, |
6 | 22 | SUPPORTED_VIDEO_EXTENSIONS, |
7 | 23 | } from '@/lib/uploads/utils/validation' |
8 | 24 |
|
9 | | -export function PdfIcon(props: SVGProps<SVGSVGElement>) { |
10 | | - return ( |
11 | | - <svg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg' {...props}> |
12 | | - <rect x='4' y='2' width='16' height='20' rx='2' stroke='currentColor' strokeWidth='1.5' /> |
13 | | - <text |
14 | | - x='12' |
15 | | - y='12' |
16 | | - textAnchor='middle' |
17 | | - dominantBaseline='central' |
18 | | - fontSize='5.5' |
19 | | - fontWeight='bold' |
20 | | - fontFamily='Arial, sans-serif' |
21 | | - letterSpacing='0.5' |
22 | | - fill='currentColor' |
23 | | - > |
24 | | - PDF |
25 | | - </text> |
26 | | - </svg> |
27 | | - ) |
28 | | -} |
29 | | - |
30 | | -export function DocxIcon(props: SVGProps<SVGSVGElement>) { |
31 | | - return ( |
32 | | - <svg |
33 | | - viewBox='0 0 24 24' |
34 | | - fill='none' |
35 | | - stroke='currentColor' |
36 | | - strokeWidth='1.5' |
37 | | - strokeLinecap='round' |
38 | | - strokeLinejoin='round' |
39 | | - xmlns='http://www.w3.org/2000/svg' |
40 | | - {...props} |
41 | | - > |
42 | | - <path d='M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z' /> |
43 | | - <path d='M14 2v4a2 2 0 0 0 2 2h4' /> |
44 | | - <path d='M16 9H8' /> |
45 | | - <path d='M16 13H8' /> |
46 | | - <path d='M16 17H8' /> |
47 | | - </svg> |
48 | | - ) |
49 | | -} |
50 | | - |
51 | | -export function XlsxIcon(props: SVGProps<SVGSVGElement>) { |
52 | | - return ( |
53 | | - <svg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg' {...props}> |
54 | | - <rect x='3' y='3' width='18' height='18' rx='2' stroke='currentColor' strokeWidth='1.5' /> |
55 | | - <line x1='3' y1='9' x2='21' y2='9' stroke='currentColor' strokeWidth='1.5' /> |
56 | | - <line x1='3' y1='15' x2='21' y2='15' stroke='currentColor' strokeWidth='1.5' /> |
57 | | - <line x1='9' y1='3' x2='9' y2='21' stroke='currentColor' strokeWidth='1.5' /> |
58 | | - <line x1='15' y1='3' x2='15' y2='21' stroke='currentColor' strokeWidth='1.5' /> |
59 | | - </svg> |
60 | | - ) |
61 | | -} |
62 | | - |
63 | | -export function CsvIcon(props: SVGProps<SVGSVGElement>) { |
64 | | - return ( |
65 | | - <svg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg' {...props}> |
66 | | - <rect x='3' y='1' width='8' height='6' rx='1.5' stroke='currentColor' strokeWidth='1.5' /> |
67 | | - <rect x='13' y='1' width='8' height='6' rx='1.5' stroke='currentColor' strokeWidth='1.5' /> |
68 | | - <rect x='3' y='9' width='8' height='6' rx='1.5' stroke='currentColor' strokeWidth='1.5' /> |
69 | | - <rect x='13' y='9' width='8' height='6' rx='1.5' stroke='currentColor' strokeWidth='1.5' /> |
70 | | - <rect x='3' y='17' width='8' height='6' rx='1.5' stroke='currentColor' strokeWidth='1.5' /> |
71 | | - <rect x='13' y='17' width='8' height='6' rx='1.5' stroke='currentColor' strokeWidth='1.5' /> |
72 | | - </svg> |
73 | | - ) |
74 | | -} |
75 | | - |
76 | | -export function TxtIcon(props: SVGProps<SVGSVGElement>) { |
77 | | - return ( |
78 | | - <svg |
79 | | - viewBox='0 0 24 24' |
80 | | - fill='none' |
81 | | - stroke='currentColor' |
82 | | - strokeWidth='1.5' |
83 | | - strokeLinecap='round' |
84 | | - strokeLinejoin='round' |
85 | | - xmlns='http://www.w3.org/2000/svg' |
86 | | - {...props} |
87 | | - > |
88 | | - <path d='M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z' /> |
89 | | - <path d='M14 2v4a2 2 0 0 0 2 2h4' /> |
90 | | - <path d='M16 13H8' /> |
91 | | - <path d='M12 17H8' /> |
92 | | - </svg> |
93 | | - ) |
94 | | -} |
95 | | - |
96 | | -export function PptxIcon(props: SVGProps<SVGSVGElement>) { |
97 | | - return ( |
98 | | - <svg |
99 | | - viewBox='0 0 24 24' |
100 | | - fill='none' |
101 | | - stroke='currentColor' |
102 | | - strokeWidth='1.5' |
103 | | - strokeLinecap='round' |
104 | | - strokeLinejoin='round' |
105 | | - xmlns='http://www.w3.org/2000/svg' |
106 | | - {...props} |
107 | | - > |
108 | | - <rect x='2' y='4' width='20' height='16' rx='2' /> |
109 | | - <line x1='6' y1='9' x2='18' y2='9' /> |
110 | | - <line x1='8' y1='14' x2='16' y2='14' /> |
111 | | - </svg> |
112 | | - ) |
113 | | -} |
114 | | - |
115 | | -export function AudioIcon(props: SVGProps<SVGSVGElement>) { |
116 | | - return ( |
117 | | - <svg |
118 | | - viewBox='0 0 24 24' |
119 | | - fill='none' |
120 | | - stroke='currentColor' |
121 | | - strokeWidth='2' |
122 | | - strokeLinecap='round' |
123 | | - xmlns='http://www.w3.org/2000/svg' |
124 | | - {...props} |
125 | | - > |
126 | | - <line x1='4' y1='14' x2='4' y2='10' /> |
127 | | - <line x1='8' y1='17' x2='8' y2='7' /> |
128 | | - <line x1='12' y1='15' x2='12' y2='9' /> |
129 | | - <line x1='16' y1='18' x2='16' y2='6' /> |
130 | | - <line x1='20' y1='14' x2='20' y2='10' /> |
131 | | - </svg> |
132 | | - ) |
133 | | -} |
134 | | - |
135 | | -export function VideoIcon(props: SVGProps<SVGSVGElement>) { |
136 | | - return ( |
137 | | - <svg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg' {...props}> |
138 | | - <rect x='2' y='4' width='20' height='16' rx='2' stroke='currentColor' strokeWidth='1.5' /> |
139 | | - <path d='M10 9l5 3-5 3V9Z' fill='currentColor' /> |
140 | | - </svg> |
141 | | - ) |
142 | | -} |
143 | | - |
144 | | -export function ChartFileIcon(props: SVGProps<SVGSVGElement>) { |
145 | | - return ( |
146 | | - <svg |
147 | | - viewBox='0 0 24 24' |
148 | | - fill='none' |
149 | | - stroke='currentColor' |
150 | | - strokeWidth='1.5' |
151 | | - strokeLinecap='round' |
152 | | - strokeLinejoin='round' |
153 | | - xmlns='http://www.w3.org/2000/svg' |
154 | | - {...props} |
155 | | - > |
156 | | - <path d='M3 3v17a1 1 0 0 0 1 1h17' /> |
157 | | - <rect x='7' y='12' width='3' height='6' rx='0.5' /> |
158 | | - <rect x='12.5' y='8' width='3' height='10' rx='0.5' /> |
159 | | - <rect x='18' y='5' width='3' height='13' rx='0.5' /> |
160 | | - </svg> |
161 | | - ) |
162 | | -} |
163 | | - |
164 | | -export function HtmlIcon(props: SVGProps<SVGSVGElement>) { |
165 | | - return ( |
166 | | - <svg |
167 | | - viewBox='0 0 24 24' |
168 | | - fill='none' |
169 | | - stroke='currentColor' |
170 | | - strokeWidth='1.5' |
171 | | - strokeLinecap='round' |
172 | | - strokeLinejoin='round' |
173 | | - xmlns='http://www.w3.org/2000/svg' |
174 | | - {...props} |
175 | | - > |
176 | | - <path d='M8 8l-4 4 4 4' /> |
177 | | - <path d='M16 8l4 4-4 4' /> |
178 | | - <line x1='14' y1='4' x2='10' y2='20' /> |
179 | | - </svg> |
180 | | - ) |
181 | | -} |
182 | | - |
183 | | -export function JsonIcon(props: SVGProps<SVGSVGElement>) { |
184 | | - return ( |
185 | | - <svg |
186 | | - viewBox='0 0 24 24' |
187 | | - fill='none' |
188 | | - stroke='currentColor' |
189 | | - strokeWidth='1.5' |
190 | | - strokeLinecap='round' |
191 | | - strokeLinejoin='round' |
192 | | - xmlns='http://www.w3.org/2000/svg' |
193 | | - {...props} |
194 | | - > |
195 | | - <path d='M8 3H7a2 2 0 0 0-2 2v4c0 1.1-.9 2-2 2 1.1 0 2 .9 2 2v4a2 2 0 0 0 2 2h1' /> |
196 | | - <path d='M16 3h1a2 2 0 0 1 2 2v4c0 1.1.9 2 2 2-1.1 0-2 .9-2 2v4a2 2 0 0 1-2 2h-1' /> |
197 | | - </svg> |
198 | | - ) |
199 | | -} |
200 | | - |
201 | | -export function MarkdownIcon(props: SVGProps<SVGSVGElement>) { |
202 | | - return ( |
203 | | - <svg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg' {...props}> |
204 | | - <rect x='2' y='4' width='20' height='16' rx='3' stroke='currentColor' strokeWidth='1.5' /> |
205 | | - <path |
206 | | - d='M6 15V9l3 3.5L12 9v6' |
207 | | - stroke='currentColor' |
208 | | - strokeWidth='1.5' |
209 | | - strokeLinecap='round' |
210 | | - strokeLinejoin='round' |
211 | | - /> |
212 | | - <path |
213 | | - d='M17 9v6m-2-2l2 2 2-2' |
214 | | - stroke='currentColor' |
215 | | - strokeWidth='1.5' |
216 | | - strokeLinecap='round' |
217 | | - strokeLinejoin='round' |
218 | | - /> |
219 | | - </svg> |
220 | | - ) |
221 | | -} |
222 | | - |
223 | | -export function ZipIcon(props: SVGProps<SVGSVGElement>) { |
224 | | - return ( |
225 | | - <svg |
226 | | - viewBox='0 0 24 24' |
227 | | - fill='none' |
228 | | - stroke='currentColor' |
229 | | - strokeWidth='1.5' |
230 | | - strokeLinecap='round' |
231 | | - strokeLinejoin='round' |
232 | | - xmlns='http://www.w3.org/2000/svg' |
233 | | - {...props} |
234 | | - > |
235 | | - <path d='M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z' /> |
236 | | - <path d='M14 2v4a2 2 0 0 0 2 2h4' /> |
237 | | - <path d='M10 5h1' /> |
238 | | - <path d='M11 8h1' /> |
239 | | - <path d='M10 11h1' /> |
240 | | - <rect x='9' y='14' width='4' height='5' rx='1' /> |
241 | | - </svg> |
242 | | - ) |
243 | | -} |
244 | | - |
245 | | -export function DefaultFileIcon(props: SVGProps<SVGSVGElement>) { |
246 | | - return ( |
247 | | - <svg |
248 | | - viewBox='0 0 24 24' |
249 | | - fill='none' |
250 | | - stroke='currentColor' |
251 | | - strokeWidth='1.5' |
252 | | - strokeLinecap='round' |
253 | | - strokeLinejoin='round' |
254 | | - xmlns='http://www.w3.org/2000/svg' |
255 | | - {...props} |
256 | | - > |
257 | | - <path d='M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z' /> |
258 | | - <path d='M14 2v4a2 2 0 0 0 2 2h4' /> |
259 | | - </svg> |
260 | | - ) |
261 | | -} |
262 | | - |
263 | 25 | export function getDocumentIcon( |
264 | 26 | rawMimeType: string, |
265 | 27 | filename: string |
|
0 commit comments