-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
71 lines (69 loc) · 2.04 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { h, Fragment } from "../deps.ts";
import { Input } from "./components/Input.tsx";
import { commonContentTypes } from "./commonContentTypes.ts";
import { adjectives } from "./adjectives.ts";
import { nouns } from "./nouns.ts";
const random = <T extends unknown>(arr: T[]): T =>
arr[Math.floor(Math.random() * arr.length)];
export const App = () => (
<>
<header style={{ fontSize: "125%" }}>
<span style={{ fontStyle: "italic" }}>ephemeral</span>
<a
style={{ float: "right", width: "1.1em", height: "1.1em" }}
title="View on GitHub"
href="https://github.com/voces/ephemeral"
>
<img src="github.svg" style={{ width: "100%" }} />
</a>
</header>
<form
style={{
margin: "auto",
width: "min(64em, 90%)",
flex: 1,
display: "flex",
flexDirection: "column",
alignItems: "center",
}}
method="POST"
>
<textarea
name="body"
style={{
width: "calc(100% - 0.5em - 2px)",
height: "min(100%, 32em)",
minWidth: "calc(100% - 0.5em - 2px)",
minHeight: "4em",
}}
placeholder={JSON.stringify({ foo: "bar" }, null, 2)}
/>
<div class="controls">
<Input
name="password"
label="Password"
type="password"
divStyle={{ flexShrink: 1 }}
inputStyle={{ width: "calc(100% - 0.5em - 2px)" }}
/>
<Input
name="path"
placeholder="file.json"
initialValue={`${random(adjectives)}-${random(nouns)}`}
label="Slug"
divStyle={{ flexShrink: 1 }}
inputStyle={{ width: "calc(100% - 0.5em - 2px)" }}
/>
<Input
name="contenttype"
placeholder="text/plain"
label="Content type"
dataListItems={commonContentTypes}
divStyle={{ flexShrink: 1 }}
inputStyle={{ width: "calc(100% - 0.5em - 2px)" }}
/>
<button type="submit">Submit</button>
</div>
</form>
</>
);