Compare commits

..

4 commits

Author SHA1 Message Date
170e23cba7
Update styling 2022-07-27 19:54:13 -07:00
Ninja3047
7b7d119831
Merge pull request #3 from Ninja3047/master
fix typescript errors, add tsconfig.json
2022-07-27 22:08:59 -04:00
Ninja3047
8d0abe0195
remove tsconfig 2022-07-27 22:06:53 -04:00
Ninja3047
7c383e8cd0
fix typescript errors, add tsconfig.json 2022-07-27 21:55:23 -04:00
2 changed files with 53 additions and 27 deletions

View file

@ -29,7 +29,7 @@ body {
}
.unselectable {
user-select: none;
user-select: none;
}
hr {
@ -88,7 +88,9 @@ th {
cursor: pointer;
}
img, audio, video {
img,
audio,
video {
border-radius: $padding;
margin-bottom: $padding;
max-height: 75vh;
@ -96,11 +98,9 @@ img, audio, video {
}
textarea {
width: 100%;
height: 100%;
min-width: 75vw;
min-height: 75vh;
box-sizing: border-box;
@extend .paste;
height: 75vh;
border-color: white;
}
.primary {
@ -117,3 +117,29 @@ textarea {
padding-left: $padding;
}
}
.button {
@extend .hljs;
border: 1px solid white;
border-radius: $padding;
padding: $padding;
margin: $padding;
font-size: 16px;
&:hover {
cursor: pointer;
}
}
.file-upload {
@extend .button;
input {
display: none;
}
}
.text-upload {
@extend .button;
}

View file

@ -25,20 +25,21 @@ require('highlightjs-line-numbers.js');
const FileForm = () => {
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
let file = event.target.files![0];
const fr = new FileReader();
fr.onload = (e) => {
const { result } = e.target;
if (result instanceof ArrayBuffer) {
let data = new Uint8Array(result);
encrypt_array_buffer(data);
}
fr.onload = (_e) => {
let data = new Uint8Array(fr.result as ArrayBuffer);
encrypt_array_buffer(data);
}
fr.readAsArrayBuffer((event.target as HTMLInputElement).files[0]);
fr.readAsArrayBuffer(file);
}
return (
<input type="file" onChange={handleChange} />
)
return <>
<label className="file-upload" >
Select a file
<input type="file" onChange={handleChange} />
</label>
</>
}
const PasteForm = () => {
@ -50,22 +51,21 @@ const PasteForm = () => {
}
return (
<pre className='paste'>
<form className='hljs centered' onSubmit={handleSubmit}>
<textarea
placeholder="Sample text"
value={value}
onChange={(e) => setValue(e.target.value)}
/>
<input type="submit" value="submit" />
</form>
</pre>
<form className='hljs centered' onSubmit={handleSubmit}>
<textarea
placeholder="Sample text"
value={value}
onChange={(e) => setValue(e.target.value)}
/>
<input className="text-upload" type="submit" value="submit" />
</form>
)
}
function createUploadUi() {
const html = <main className='hljs centered fullscreen'>
<FileForm />
<p>or paste your data below</p>
<PasteForm />
</main>;