update,
This commit is contained in:
@@ -11,18 +11,12 @@ import { uploadClasses } from './classes';
|
||||
import { RejectionFiles } from './components/rejection-files';
|
||||
|
||||
import type { UploadProps } from './types';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export function UploadAvatar({
|
||||
sx,
|
||||
error,
|
||||
value,
|
||||
disabled,
|
||||
helperText,
|
||||
className,
|
||||
...other
|
||||
}: UploadProps) {
|
||||
export function UploadAvatar({ sx, error, value, disabled, helperText, className, ...other }: UploadProps) {
|
||||
const { t } = useTranslation();
|
||||
const { getRootProps, getInputProps, isDragActive, isDragReject, fileRejections } = useDropzone({
|
||||
multiple: false,
|
||||
disabled,
|
||||
@@ -44,10 +38,7 @@ export function UploadAvatar({
|
||||
}
|
||||
}, [value]);
|
||||
|
||||
const renderPreview = () =>
|
||||
hasFile && (
|
||||
<Image alt="Avatar" src={preview} sx={{ width: 1, height: 1, borderRadius: '50%' }} />
|
||||
);
|
||||
const renderPreview = () => hasFile && <Image alt="Avatar" src={preview} sx={{ width: 1, height: 1, borderRadius: '50%' }} />;
|
||||
|
||||
const renderPlaceholder = () => (
|
||||
<Box
|
||||
@@ -85,7 +76,7 @@ export function UploadAvatar({
|
||||
>
|
||||
<Iconify icon="solar:camera-add-bold" width={32} />
|
||||
|
||||
<Typography variant="caption">{hasFile ? 'Update photo' : 'Upload photo'}</Typography>
|
||||
<Typography variant="caption">{hasFile ? t('Update photo') : t('Update photo')}</Typography>
|
||||
</Box>
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user