generated from CraftionsMC/craftions-base
-
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.
- Loading branch information
MCTzOCK
committed
Nov 1, 2021
1 parent
acb98e6
commit 83c2695
Showing
11 changed files
with
269 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,56 @@ | ||
/** | ||
* @author Ben Siebert <[email protected]> | ||
* @copyright (c) 2018-2021 Ben Siebert. All rights reserved. | ||
*/ | ||
|
||
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap'); | ||
.d-a{ | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
.drag-area{ | ||
border: 2px dashed #fff; | ||
height: 500px; | ||
width: 700px; | ||
border-radius: 5px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
flex-direction: column; | ||
} | ||
.drag-area.active{ | ||
border: 2px solid #fff; | ||
} | ||
.drag-area .icon{ | ||
font-size: 100px; | ||
color: #fff; | ||
} | ||
.drag-area header{ | ||
font-size: 30px; | ||
font-weight: 500; | ||
color: #fff; | ||
} | ||
.drag-area span{ | ||
font-size: 25px; | ||
font-weight: 500; | ||
color: #fff; | ||
margin: 10px 0 15px 0; | ||
} | ||
.drag-area button{ | ||
padding: 10px 25px; | ||
font-size: 20px; | ||
font-weight: 500; | ||
border: none; | ||
outline: none; | ||
background: #fff; | ||
color: #5256ad; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
} | ||
.drag-area img{ | ||
height: 100%; | ||
width: 100%; | ||
object-fit: cover; | ||
border-radius: 5px; | ||
} |
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,59 @@ | ||
/** | ||
* @author Ben Siebert <[email protected]> | ||
* @copyright (c) 2018-2021 Ben Siebert. All rights reserved. | ||
*/ | ||
|
||
import * as React from "react"; | ||
import { useEffect } from "react"; | ||
import "./Share.scss"; | ||
|
||
export default function Share() { | ||
useEffect(() => { | ||
const dropArea = document.querySelector(".drag-area") as HTMLDivElement, | ||
dragText = dropArea.querySelector("#upl-header") as HTMLDivElement, | ||
button = dropArea.querySelector("#upl-button") as HTMLButtonElement, | ||
input = dropArea.querySelector("#upl-input") as HTMLInputElement; | ||
let file: Blob; | ||
|
||
button.onclick = () => { | ||
input.click(); | ||
}; | ||
|
||
input.addEventListener("change", function () { | ||
// @ts-ignore | ||
file = this.files[0]; | ||
dropArea.classList.add("active"); | ||
uploadFile(); | ||
}); | ||
|
||
function uploadFile() { | ||
const form = document.querySelector("#upl-form") as HTMLFormElement; | ||
form.submit(); | ||
} | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<h1 className={"title has-text-centered"}>Share Files</h1> | ||
<div className="d-a"> | ||
<div className="drag-area"> | ||
<div className="icon"> | ||
<i className="fas fa-cloud-upload-alt" /> | ||
</div> | ||
<header id={"upl-header"}>Upload File</header> | ||
<button id={"upl-button"} className={"mt-4"}> | ||
Browse File | ||
</button> | ||
<form | ||
id={"upl-form"} | ||
action={"/api/upload"} | ||
method={"post"} | ||
encType={"multipart/form-data"} | ||
> | ||
<input name="uplFile" type="file" hidden id={"upl-input"} /> | ||
</form> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
} |
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,30 @@ | ||
/** | ||
* @author Ben Siebert <[email protected]> | ||
* @copyright (c) 2018-2021 Ben Siebert. All rights reserved. | ||
*/ | ||
|
||
import * as React from "react"; | ||
|
||
export default function Success() { | ||
const usp = new URLSearchParams(location.search); | ||
|
||
return ( | ||
<> | ||
<h1 className="title has-text-centered">Uploaded File!</h1> | ||
<h2 className="subtitle has-text-centered"> | ||
Your File has been uploaded! You can download your file at | ||
<a | ||
href={decodeURIComponent(usp.get("url") as string)} | ||
target={"_blank"} | ||
rel={"noreferrer"} | ||
> | ||
{location.protocol + | ||
"//" + | ||
location.host + | ||
decodeURIComponent(usp.get("url") as string)} | ||
</a> | ||
. | ||
</h2> | ||
</> | ||
); | ||
} |
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