Skip to content

Commit

Permalink
edits
Browse files Browse the repository at this point in the history
  • Loading branch information
ArpitSureka committed Feb 5, 2024
1 parent 3d99b2b commit 82bbfcd
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
25 changes: 25 additions & 0 deletions admin_panel/ui/components/upload-image.edit copy.jsx
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
17 changes: 17 additions & 0 deletions admin_panel/ui/components/upload-image.list.jsx
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

0 comments on commit 82bbfcd

Please sign in to comment.