Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
FIX Image Upload Preview Size (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricklove authored Mar 8, 2021
1 parent a0f6ce6 commit 62a7591
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions client/src/components/CreateNonFungiblePage/FileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
export function FilePreview({ file }: { file: SelectedFile }) {
const dispatch = useDispatch();
if (/^image\/.*/.test(file.type)) {
return <Image src={file.objectUrl} />;
return <Image src={file.objectUrl} width="100%" height="100%" objectFit='contain' />;
}
if (/^video\/.*/.test(file.type)) {
const canvasRef = createRef<HTMLCanvasElement>();
Expand Down Expand Up @@ -101,8 +101,16 @@ export default function FileUpload() {
>
<Box as="input" {...getInputProps()} />
{state.selectedFile?.objectUrl ? (
<Box p={4} maxWidth="400px" maxHeight="400px">
<FilePreview file={state.selectedFile} />
<Box p={4}>
<Flex
justify="center"
align="center"
maxWidth="400px"
maxHeight="400px"
overflow="hidden"
>
<FilePreview file={state.selectedFile} />
</Flex>
</Box>
) : (
<Flex
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/CreateNonFungiblePage/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export default function Preview() {
boxShadow="0px 0px 0px 4px rgba(211, 222, 245, 0.3)"
>
<Flex
width="100"
justify="center"
align="center"
width="300px"
height="300px"
overflow="hidden"
>
Expand Down

0 comments on commit 62a7591

Please sign in to comment.