Compare commits
4 commits
253fccaf78
...
170e23cba7
Author | SHA1 | Date | |
---|---|---|---|
170e23cba7 | |||
|
7b7d119831 | ||
|
8d0abe0195 | ||
|
7c383e8cd0 |
2 changed files with 53 additions and 27 deletions
|
@ -88,7 +88,9 @@ th {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
img, audio, video {
|
img,
|
||||||
|
audio,
|
||||||
|
video {
|
||||||
border-radius: $padding;
|
border-radius: $padding;
|
||||||
margin-bottom: $padding;
|
margin-bottom: $padding;
|
||||||
max-height: 75vh;
|
max-height: 75vh;
|
||||||
|
@ -96,11 +98,9 @@ img, audio, video {
|
||||||
}
|
}
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
width: 100%;
|
@extend .paste;
|
||||||
height: 100%;
|
height: 75vh;
|
||||||
min-width: 75vw;
|
border-color: white;
|
||||||
min-height: 75vh;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.primary {
|
.primary {
|
||||||
|
@ -117,3 +117,29 @@ textarea {
|
||||||
padding-left: $padding;
|
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;
|
||||||
|
}
|
|
@ -25,20 +25,21 @@ require('highlightjs-line-numbers.js');
|
||||||
|
|
||||||
const FileForm = () => {
|
const FileForm = () => {
|
||||||
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
let file = event.target.files![0];
|
||||||
const fr = new FileReader();
|
const fr = new FileReader();
|
||||||
fr.onload = (e) => {
|
fr.onload = (_e) => {
|
||||||
const { result } = e.target;
|
let data = new Uint8Array(fr.result as ArrayBuffer);
|
||||||
if (result instanceof ArrayBuffer) {
|
|
||||||
let data = new Uint8Array(result);
|
|
||||||
encrypt_array_buffer(data);
|
encrypt_array_buffer(data);
|
||||||
}
|
}
|
||||||
}
|
fr.readAsArrayBuffer(file);
|
||||||
fr.readAsArrayBuffer((event.target as HTMLInputElement).files[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return <>
|
||||||
|
<label className="file-upload" >
|
||||||
|
Select a file
|
||||||
<input type="file" onChange={handleChange} />
|
<input type="file" onChange={handleChange} />
|
||||||
)
|
</label>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
const PasteForm = () => {
|
const PasteForm = () => {
|
||||||
|
@ -50,22 +51,21 @@ const PasteForm = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<pre className='paste'>
|
|
||||||
<form className='hljs centered' onSubmit={handleSubmit}>
|
<form className='hljs centered' onSubmit={handleSubmit}>
|
||||||
<textarea
|
<textarea
|
||||||
placeholder="Sample text"
|
placeholder="Sample text"
|
||||||
value={value}
|
value={value}
|
||||||
onChange={(e) => setValue(e.target.value)}
|
onChange={(e) => setValue(e.target.value)}
|
||||||
/>
|
/>
|
||||||
<input type="submit" value="submit" />
|
<input className="text-upload" type="submit" value="submit" />
|
||||||
</form>
|
</form>
|
||||||
</pre>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function createUploadUi() {
|
function createUploadUi() {
|
||||||
const html = <main className='hljs centered fullscreen'>
|
const html = <main className='hljs centered fullscreen'>
|
||||||
<FileForm />
|
<FileForm />
|
||||||
|
<p>or paste your data below</p>
|
||||||
<PasteForm />
|
<PasteForm />
|
||||||
</main>;
|
</main>;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue