Skip to content

Commit d751c85

Browse files
authored
feat: website design
1 parent 8d0236b commit d751c85

File tree

6 files changed

+60
-33
lines changed

6 files changed

+60
-33
lines changed

.vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"deno.enable": true,
3+
"deno.lint": true,
4+
"deno.unstable": true
5+
}

components/Footer.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/** @jsx h */
2+
/** @jsxFrag Fragment */
3+
4+
import { h, tw } from "../client_deps.ts";
5+
6+
export default function Footer() {
7+
const container = tw`text-gray-600 text-sm`;
8+
const text = tw`mt-5 flex justify-center text-gray-400 hover:text-gray-400`;
9+
return (
10+
<section class={container}>
11+
<a class={text} href="https://github.com/denosaurs">© 2022 Denosaurs</a>
12+
</section>
13+
);
14+
}

components/Header.tsx

+12-12
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
import { h, tw } from "../client_deps.ts";
55

66
export default function Header() {
7-
const container = tw`w-full h-64 flex justify-center items-center flex-col`;
8-
const title = tw`max-w-screen-sm mt-4 font-bold text(4xl gray-900 center)`;
9-
const subtitle = tw`max-w-screen-sm mt-4 text(xl gray-600 center)`;
10-
return (
11-
<section class={container}>
12-
<p class={title}>python.mod.land</p>
13-
<p class={subtitle}>
14-
A fast CDN to use statically typed Python modules in Deno.
15-
</p>
16-
</section>
17-
);
7+
const container = tw`w-full h-64 flex justify-center items-center flex-col border-b-2`;
8+
const title = tw`max-w-screen-sm mt-4 font-bold text(4xl gray-900 center)`;
9+
const subtitle = tw`max-w-screen-sm mt-4 text(xl gray-600 center)`;
10+
const icon = tw`bi bi-github`;
11+
return (
12+
<section class={container}>
13+
<p class={title}>python.mod.land <a class={icon} href="https://github.com/denosaurs/python.mod.land" style="font-size: 1.5rem;" ></a></p>
14+
<p class={subtitle}>
15+
A fast CDN to use statically typed Python modules in Deno.
16+
</p>
17+
</section>
18+
);
1819
}
19-

routes/[name].tsx

+18-11
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
/** @jsxFrag Fragment */
33
import { Fragment, h, tw, hljs } from "../client_deps.ts";
44
import Header from "../components/Header.tsx";
5+
import Footer from "../components/Footer.tsx";
56
import { Handlers, css } from "../server_deps.ts";
67
import { checkExist, isHtmlRequest } from "../utils.ts";
78
// deno-lint-ignore no-explicit-any
89
function Block(props: any) {
910
const block = tw`bg-gray-100 p-3 hljs rounded`;
1011
// deno-lint-ignore no-explicit-any
11-
const code = (hljs as any).highlight(props.code, {language: 'javascript'}).value
12+
const code = (hljs as any).highlight(props.code, { language: 'javascript' }).value
1213
return (
1314
<div class={block}>
14-
<pre><code dangerouslySetInnerHTML={{__html: code}}></code></pre>
15+
<pre><code dangerouslySetInnerHTML={{ __html: code }}></code></pre>
1516
</div>
1617
);
1718
}
@@ -30,14 +31,20 @@ export const handler: Handlers = {
3031

3132
export default function ModulePage(ctx: any) {
3233
const main = tw`max-w-screen-sm mx-auto px(4 sm:4 md:4) space-y-3 mb-8`;
33-
const text = tw`text-gray-600 text-lg`;
34-
return <>
35-
<style>{css}</style>
36-
<Header/>
37-
<section class={main}>
38-
<p class={text}>Import from a URL</p>
39-
<Block code={`import ${ctx.params.name.replace(".","")} from "https://python.mod.land/pkg/${ctx.params.name}"`}></Block>
40-
</section>
41-
</>
34+
const text = tw`text-gray-600 text-lg pt-8`;
35+
return <html>
36+
<head>
37+
<title>{ctx.params.name} - Python Land</title>
38+
</head>
39+
<body>
40+
<style>{css}</style>
41+
<Header />
42+
<section class={main}>
43+
<p class={text}>Import from a URL</p>
44+
<Block code={`import ${ctx.params.name.replace(".", "")} from "https://python.mod.land/pkg/${ctx.params.name}"`}></Block>
45+
</section>
46+
<Footer />
47+
</body>
48+
</html>
4249
}
4350

routes/index.tsx

+10-7
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,35 @@
44
import { Fragment, h, Head, hljs, tw } from "../client_deps.ts";
55
import { css } from "../server_deps.ts";
66
import Header from "../components/Header.tsx";
7+
import Footer from "../components/Footer.tsx";
78
import List from "../islands/List.tsx";
89

910
export default function Index() {
10-
const main = tw`max-w-screen-sm mx-auto px(4 sm:4 md:4) space-y-3 mb-8`;
11+
const main = tw`max-w-screen-sm mx-auto px(4 sm:4 md:4) space-y-3 mb-8 pt-8`;
1112
const projects = tw`max-w-screen-sm mx-auto px(4 sm:4 md:4) space-y-3 mb-8 `;
1213
const text = tw`text-gray-600 text-lg`;
1314

1415
return (
1516
<>
1617
<Head>
17-
<title>Python Land</title>
18+
<title>Python Land - A fast CDN to use statically typed Python modules in Deno.</title>
1819
<meta
1920
name="description"
2021
content="A fast CDN to use statically typed Python modules in Deno."
2122
/>
22-
<style>{css}</style>
23+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css"/>
24+
<style>{css}</style>
2325
</Head>
24-
<Header/>
26+
<Header />
2527
<section class={main}>
2628
<p class={text}>Import from a URL</p>
2729
<Block code={'import np from "https://python.mod.land/pkg/numpy"'}></Block>
2830
</section>
2931
<section class={projects}>
3032
<p class={text}>Top Projects</p>
31-
<List/>
33+
<List />
3234
</section>
35+
<Footer />
3336
</>
3437
);
3538
}
@@ -38,10 +41,10 @@ export default function Index() {
3841
function Block(props: any) {
3942
const block = tw`bg-gray-100 p-3 hljs rounded`;
4043
// deno-lint-ignore no-explicit-any
41-
const code = (hljs as any).highlight(props.code, {language: 'javascript'}).value
44+
const code = (hljs as any).highlight(props.code, { language: 'javascript' }).value
4245
return (
4346
<div class={block}>
44-
<pre><code dangerouslySetInnerHTML={{__html: code}}></code></pre>
47+
<pre><code dangerouslySetInnerHTML={{ __html: code }}></code></pre>
4548
</div>
4649
);
4750
}

utils.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,4 @@ export function checkExist(name: string, callback: (exists: any) => void) {
66
});
77
}
88

9-
export function isHtmlRequest(req: Request) {
10-
return accepts(req, "application/*", "text/html") === "text/html";
11-
}
9+
export const isHtmlRequest = (req: Request) => accepts(req, "application/*", "text/html") === "text/html";

0 commit comments

Comments
 (0)