-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
122 lines (109 loc) · 3.52 KB
/
index.html
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Defund12 image</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"
rel="stylesheet"
/>
</head>
<body>
<div id="root"></div>
<script
crossorigin
src="https://unpkg.com/react@16/umd/react.production.min.js"
></script>
<script
crossorigin
src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"
></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>
<script type="text/babel">
const App = () => {
const [city, setCity] = React.useState("City");
const [path, setPath] = React.useState("path");
const [color, setColor] = React.useState("blue");
const [titleSize, setTitleSize] = React.useState("120");
const [url, setUrl] = React.useState(null);
const handleSubmit = (e) => {
e.preventDefault();
const params = `path=${encodeURIComponent(
path.toLowerCase()
)}&city=${encodeURIComponent(city)}&color=${encodeURIComponent(
color
)}&titleSize=${encodeURIComponent(titleSize)}`;
const url = `https://defund12.vercel.app/api/insta?${params}`;
setUrl(url);
};
const colors = [
"yellow",
"magenta",
"green",
"blue",
"turquoise",
"orange",
"purple",
"pink",
"red",
];
return (
<div className="p-4">
<form onSubmit={handleSubmit} className="mb-10">
<textarea
onChange={(e) => setCity(e.target.value)}
value={city}
class="border block mb-3 rounded p-2"
placeholder="edit me"
></textarea>
<input
onChange={(e) => setPath(e.target.value)}
value={path}
class="border block mb-3 rounded p-2"
placeholder="path"
/>
<input
onChange={(e) => setTitleSize(e.target.value)}
value={titleSize}
class="border block mb-3 rounded p-2"
placeholder="120"
/>
<div className="mb-3">
{colors.map((colorItem) => (
<div>
<input
type="radio"
id={colorItem}
name={colorItem}
value={colorItem}
className="mr-2"
checked={color === colorItem}
onClick={() => setColor(colorItem)}
/>
<label for={colorItem}>{colorItem}</label>
</div>
))}
</div>
<button
type="submit"
className="bg-blue-500 p-2 px-3 rounded text-white"
>
Generate
</button>
</form>
{url && (
<div className="">
<a className="text-blue-500" href={url}>
{url}
</a>
<img src={url} className="mt-3 max-w-xl" />
</div>
)}
</div>
);
};
ReactDOM.render(<App />, document.getElementById("root"));
</script>
</body>
</html>