source: src/components/upload/upload-box.tsx@ 5d6f37a

main
Last change on this file since 5d6f37a was 5d6f37a, checked in by Naum Shapkarovski <naumshapkarovski@…>, 7 weeks ago

add customer

  • Property mode set to 100644
File size: 1.5 KB
Line 
1import { useDropzone } from 'react-dropzone';
2// @mui
3import { alpha } from '@mui/material/styles';
4import Box from '@mui/material/Box';
5//
6import Iconify from '../iconify';
7//
8import { UploadProps } from './types';
9
10// ----------------------------------------------------------------------
11
12export default function UploadBox({ placeholder, error, disabled, sx, ...other }: UploadProps) {
13 const { getRootProps, getInputProps, isDragActive, isDragReject } = useDropzone({
14 disabled,
15 ...other,
16 });
17
18 const hasError = isDragReject || error;
19
20 return (
21 <Box
22 {...getRootProps()}
23 sx={{
24 m: 0.5,
25 width: 64,
26 height: 64,
27 flexShrink: 0,
28 display: 'flex',
29 borderRadius: 1,
30 cursor: 'pointer',
31 alignItems: 'center',
32 color: 'text.disabled',
33 justifyContent: 'center',
34 bgcolor: (theme) => alpha(theme.palette.grey[500], 0.08),
35 border: (theme) => `dashed 1px ${alpha(theme.palette.grey[500], 0.16)}`,
36 ...(isDragActive && {
37 opacity: 0.72,
38 }),
39 ...(disabled && {
40 opacity: 0.48,
41 pointerEvents: 'none',
42 }),
43 ...(hasError && {
44 color: 'error.main',
45 borderColor: 'error.main',
46 bgcolor: (theme) => alpha(theme.palette.error.main, 0.08),
47 }),
48 '&:hover': {
49 opacity: 0.72,
50 },
51 ...sx,
52 }}
53 >
54 <input {...getInputProps()} />
55
56 {placeholder || <Iconify icon="eva:cloud-upload-fill" width={28} />}
57 </Box>
58 );
59}
Note: See TracBrowser for help on using the repository browser.