-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d99b2b
commit 82bbfcd
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react' | ||
import { Label, Box, DropZone, BasePropertyProps, DropZoneProps, DropZoneItem } from 'admin-bro' | ||
|
||
const Edit: React.FC<BasePropertyProps> = (props) => { | ||
const { property, onChange, record } = props | ||
|
||
const handleDropZoneChange: DropZoneProps['onChange'] = (files) => { | ||
onChange(property.name, files[0]) | ||
} | ||
|
||
const uploadedPhoto = record.params.profilePhotoLocation | ||
const photoToUpload = record.params[property.name] | ||
|
||
return ( | ||
<Box marginBottom="xxl"> | ||
<Label>{property.label}</Label> | ||
<DropZone onChange={handleDropZoneChange}/> | ||
{uploadedPhoto && !photoToUpload && ( | ||
<DropZoneItem src={uploadedPhoto} /> | ||
)} | ||
</Box> | ||
) | ||
} | ||
|
||
export default Edit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react' | ||
import { Box, BasePropertyProps } from 'admin-bro' | ||
|
||
const Edit: React.FC<BasePropertyProps> = (props) => { | ||
const { record } = props | ||
|
||
const srcImg = record.params['profilePhotoLocation'] | ||
return ( | ||
<Box> | ||
{srcImg ? ( | ||
<img src={srcImg} width="100px"/> | ||
) : 'no image'} | ||
</Box> | ||
) | ||
} | ||
|
||
export default Edit |