Skip to content

Commit

Permalink
Change div to button and add lower margin (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
chennisden authored Jul 25, 2024
1 parent dcf4536 commit 8ef1462
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions frontend/src/components/files/UploadImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import imageCompression from "browser-image-compression";
import TCButton from "components/files/TCButton";
import { api } from "hooks/api";
import { useAuthentication } from "hooks/auth";
import { useTheme } from "hooks/theme";
import React, { useEffect, useRef, useState } from "react";
import { Alert, Col } from "react-bootstrap";

Expand All @@ -19,6 +20,7 @@ const ImageUploadComponent: React.FC<ImageUploadProps> = ({
const [dragOver, setDragOver] = useState<boolean>(false);
const auth = useAuthentication();
const auth_api = new api(auth.api);
const { theme } = useTheme();
const MAX_FILE_SIZE = 25 * 1024 * 1024;
const validFileTypes = ["image/png", "image/jpeg", "image/jpg"];

Expand Down Expand Up @@ -150,32 +152,22 @@ const ImageUploadComponent: React.FC<ImageUploadProps> = ({
return (
<Col md="6">
<div
className="mb-3"
onDragOver={handleDragOver}
onDragLeave={handleDragLeave}
onDrop={handleDrop}
style={{
border: dragOver ? "2px dashed #000" : "2px dashed transparent",
padding: "10px",
borderRadius: "5px",
textAlign: "center",
marginBottom: "20px",
}}
>
<div
<TCButton
className="mb-3"
onClick={triggerFileInput}
style={{
cursor: "pointer",
background: "black",
border: "1px solid #ccc",
borderRadius: "5px",
display: "flex",
alignItems: "center",
justifyContent: "center",
minHeight: "40px",
}}
variant={theme === "dark" ? "outline-light" : "outline-dark"}
>
{selectedFile ? selectedFile.name : "No file chosen"}
</div>
</TCButton>
<input
type="file"
accept=".png,.jpg,.jpeg"
Expand Down

0 comments on commit 8ef1462

Please sign in to comment.