Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
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
/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "npm:react-dom/server";
import React from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
const links = [
{ name: "Portfolio", url: "https://owais-warsi.vercel.app" },
{ name: "Twitter", url: "https://x.com/MO_warsi786" },
{ name: "GitHub", url: "https://github.com/Muhammad-Owais-Warsi" },
{ name: "LinkedIn", url: "https://www.linkedin.com/in/muhammad-owais-warsi-318987276/" },
{ name: "Blogs", url: "https://knowtech.hashnode.dev/" },
];
return (
<div className="container">
<img
src="https://img.freepik.com/premium-photo/happy-freelancer-working-laptop-desk-white-background_807028-335.jpg"
alt="Profile"
className="profile-img"
/>
<h1>Owais</h1>
<p>Passionate dev who loves to ship projects!</p>
{links.map((link, index) => (
<a key={index} href={link.url} className="link-button" target="_blank" rel="noopener noreferrer">
<i className={`fab ${link.name}`}></i> {link.name}
</a>
))}
</div>
);
}
function client() {
createRoot(document.getElementById("root")).render(<App />);
}
if (typeof document !== "undefined") { client(); }
async function server(request: Request): Promise<Response> {
return new Response(
`
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Owais</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<style>${css}</style>
</head>
<body>
<div id="root"></div>
<script type="module" src="${import.meta.url}"></script>
</body>
</html>
`,
{
headers: { "content-type": "text/html" },
},
);
}
const css = `
body {
font-family: 'Arial', sans-serif;
background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.container {
background-color: white;
border-radius: 20px;
padding: 40px 20px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
text-align: center;
max-width: 400px;
width: 85%;
border: 2px solid #8e44ad;
margin: 20px auto;
}
.profile-img {
width: 120px;
height: 120px;
border-radius: 50%;
margin-bottom: 20px;
border: 3px solid #8e44ad;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}
h1 {
margin: 10px 0;
color: #8e44ad;
font-size: 2em;
}
p {
color: #555;
margin-bottom: 30px;
stevekrouse-shysapphireleopard.web.val.run
August 26, 2024