-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Aseta suunnittelusopimustiedot tallentumaan projektin tiedot -l…
…omakkeella * feat: Aseta suunnittelusopimustiedot tallentumaan projektin tiedot -lomakkeella * laita adaptSuunnitteluSopimusToSave palauttamaan null arvon, kun kannassa oleva suunnitteluSopimus on tarve poistaa * poista p-elementti, jossa sama teksti kuin alla olevan elementin sisällä * korjaa adaptSuunnitteluSopimusToSave toiminnallisuutta
- Loading branch information
Showing
17 changed files
with
410 additions
and
154 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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,65 @@ | ||
import Button from "@components/button/Button"; | ||
import React from "react"; | ||
import { FieldError } from "react-hook-form"; | ||
import FormGroup from "./FormGroup"; | ||
import { DropzoneOptions, useDropzone } from "react-dropzone"; | ||
import classNames from "classnames"; | ||
|
||
type DropzoneProps = { | ||
onChange?: React.ChangeEventHandler<HTMLInputElement>; | ||
label?: string; | ||
error?: FieldError; | ||
bottomInfoText?: string; | ||
hideErrorMessage?: boolean; | ||
} & DropzoneOptions; | ||
|
||
export const FileInput = ({ | ||
onChange, | ||
label, | ||
error, | ||
bottomInfoText, | ||
hideErrorMessage, | ||
multiple = false, | ||
noClick = true, | ||
maxSize = 4500000, | ||
accept = "image/jpeg, image/png", | ||
...otherDropzoneOptions | ||
}: DropzoneProps) => { | ||
const { getRootProps, getInputProps, isDragActive, open } = useDropzone({ | ||
multiple, | ||
noClick, | ||
maxSize, | ||
accept, | ||
...otherDropzoneOptions, | ||
}); | ||
|
||
return ( | ||
<FormGroup label={label} errorMessage={hideErrorMessage ? undefined : error?.message}> | ||
<div | ||
{...getRootProps()} | ||
className={classNames( | ||
"border-dashed border border-gray py-4 flex flex-col justify-center items-center relative", | ||
isDragActive && | ||
"before:inset-0 before:absolute before:bg-gray-light before:bg-opacity-50 before:z-50 before:pointer-events-none" | ||
)} | ||
> | ||
<p className="mb-4 vayla-paragraph flex flex-wrap justify-center"> | ||
<span>Pudota tiedosto tähän tai</span> | ||
</p> | ||
<input {...getInputProps({ onChange })} /> | ||
<Button | ||
type="button" | ||
onClick={(e) => { | ||
e.preventDefault(); | ||
open(); | ||
}} | ||
> | ||
Valitse tiedosto | ||
</Button> | ||
<p className="mt-4 mb-0">{bottomInfoText}</p> | ||
</div> | ||
</FormGroup> | ||
); | ||
}; | ||
|
||
export default FileInput; |
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
Oops, something went wrong.