~repos /website

#astro#js#html#css

git clone https://pyrossh.dev/repos/website.git

木 Personal website of pyrossh. Built with astrojs, shiki, vite.


7c7a9edc pyrossh

2 years ago
improve index
components/icons/ContactIcon.tsx ADDED
@@ -0,0 +1,11 @@
1
+ export default function ContactIcon({ size = "32" }) {
2
+ return (
3
+ <svg viewBox="0 0 24 24" width={size} height={size}>
4
+ <path
5
+ fill="currentColor"
6
+ d="M19 19H5V5h14m0-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m-2.5 13.25c0-1.5-3-2.25-4.5-2.25s-4.5.75-4.5 2.25V17h9M12 12.25A2.25 2.25 0 0 0 14.25 10 2.25 2.25 0 0 0 12 7.75 2.25 2.25 0 0 0 9.75 10 2.25 2.25 0 0 0 12 12.25z"
7
+ >
8
+ </path>
9
+ </svg>
10
+ );
11
+ }
components/icons/ProjectsIcon.tsx ADDED
@@ -0,0 +1,11 @@
1
+ export default function ProjectsIcon({ size = "32" }) {
2
+ return (
3
+ <svg viewBox="0 0 1024 1024" width={size} height={size}>
4
+ <path
5
+ fill="currentColor"
6
+ d="M280 752h80c4.4 0 8-3.6 8-8V280c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8zm192-280h80c4.4 0 8-3.6 8-8V280c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8v184c0 4.4 3.6 8 8 8zm192 72h80c4.4 0 8-3.6 8-8V280c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8v256c0 4.4 3.6 8 8 8zm216-432H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"
7
+ >
8
+ </path>
9
+ </svg>
10
+ );
11
+ }
components/icons/TreeIcon.tsx ADDED
@@ -0,0 +1,11 @@
1
+ export default function TreeIcon({ size = "32" }) {
2
+ return (
3
+ <svg viewBox="0 0 24 24" width={size} height={size}>
4
+ <path
5
+ fill="currentColor"
6
+ d="M20.781 17.375 18.081 14H19a.999.999 0 0 0 .819-1.573l-7-10a1.001 1.001 0 0 0-1.393-.246.968.968 0 0 0-.221.231c-.025.015-7.025 10.015-7.025 10.015A1 1 0 0 0 5 14h.919l-2.7 3.375c-.24.301-.287.712-.121 1.059.167.345.518.566.902.566h7v3a1 1 0 1 0 2 0v-3h7a1.001 1.001 0 0 0 .781-1.625zM13 17v-5a1 1 0 1 0-2 0v5H6.081l2.7-3.375c.24-.301.287-.712.121-1.059A1.004 1.004 0 0 0 8 12H6.92L12 4.744 17.08 12H16a1.001 1.001 0 0 0-.78 1.625L17.92 17H13z"
7
+ >
8
+ </path>
9
+ </svg>
10
+ );
11
+ }
deno.json CHANGED
@@ -20,6 +20,7 @@
20
20
  "tailwindcss": "npm:tailwindcss@3.3.5",
21
21
  "tailwindcss/": "npm:/tailwindcss@3.3.5/",
22
22
  "tailwindcss/plugin": "npm:/tailwindcss@3.3.5/plugin.js",
23
+ "tailwind-children": "npm:tailwind-children@0.5.0",
23
24
  "$std/": "https://deno.land/std@0.193.0/"
24
25
  },
25
26
  "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "preact" }
design/logo.curve ADDED
Binary file
fresh.config.ts CHANGED
@@ -4,3 +4,23 @@ import tailwind from "$fresh/plugins/tailwind.ts";
4
4
  export default defineConfig({
5
5
  plugins: [tailwind()],
6
6
  });
7
+
8
+ // import { defineConfig } from 'astro/config';
9
+ // import mdx from '@astrojs/mdx';
10
+ // import sitemap from '@astrojs/sitemap';
11
+ // import prefetch from "@astrojs/prefetch";
12
+
13
+ // // https://astro.build/config
14
+ // export default defineConfig({
15
+ // site: 'https://pyros.sh/',
16
+ // markdown: {
17
+ // shikiConfig: {
18
+ // theme: 'dark-plus'
19
+ // }
20
+ // },
21
+ // integrations: [
22
+ // mdx(),
23
+ // prefetch(),
24
+ // sitemap()
25
+ // ],
26
+ // });
fresh.gen.ts CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  import * as $_404 from "./routes/_404.tsx";
6
6
  import * as $_app from "./routes/_app.tsx";
7
+ import * as $_middleware from "./routes/_middleware.ts";
7
8
  import * as $api_joke from "./routes/api/joke.ts";
8
9
  import * as $greet_name_ from "./routes/greet/[name].tsx";
9
10
  import * as $index from "./routes/index.tsx";
@@ -15,6 +16,7 @@ const manifest = {
15
16
  routes: {
16
17
  "./routes/_404.tsx": $_404,
17
18
  "./routes/_app.tsx": $_app,
19
+ "./routes/_middleware.ts": $_middleware,
18
20
  "./routes/api/joke.ts": $api_joke,
19
21
  "./routes/greet/[name].tsx": $greet_name_,
20
22
  "./routes/index.tsx": $index,
routes/_app.tsx CHANGED
@@ -1,27 +1,26 @@
1
- import { AppProps } from "$fresh/server.ts";
1
+ import { PageProps } from "$fresh/server.ts";
2
+ import { asset } from "$fresh/runtime.ts";
2
3
  import Footer from "../components/Footer.tsx";
3
4
  import Header from "../components/Header.tsx";
4
5
 
5
- // const SEO = () => (
6
- // <title>fres</title>
7
- // <link rel="canonical" href={Astro.url} />
8
- // <meta name="viewport" content="width=device-width, initial-scale=1.0" />
9
- // <link rel="icon" type="image/png" href="/favicon.png" />
10
- // <meta name="author" content="pyrossh" />
11
- // <meta name="keywords" content="pyros.sh,pyrossh,astro,website" />
12
- // <meta property="og:site_name" content="pyros.sh" />
13
- // <meta property="og:type" content="website" />
14
- // <meta property="og:url" content={Astro.url} />
15
- // <meta property="og:site_name" content="pyros.sh" />
16
- // )
17
-
18
- export default function App({ Component }: AppProps) {
6
+ export default function App({ Component, url }: PageProps) {
19
7
  return (
20
8
  <html lang="en" class="h-full w-full">
21
9
  <head>
10
+ <title>pyros.sh</title>
22
11
  <meta charset="utf-8" />
23
12
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
13
+ <link rel="icon" type="image/png" href="/favicon.png" />
14
+ <meta name="author" content="pyrossh" />
15
+ <meta name="keywords" content="pyros.sh,pyrossh,astro,website" />
16
+ <meta property="og:site_name" content="pyros.sh" />
17
+ <meta property="og:type" content="website" />
18
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
19
+ <link rel="canonical" href={url.toString()} />
20
+ <meta property="og:url" content={url.toString()} />
21
+ <meta property="og:site_name" content="pyros.sh" />
22
+ <link rel="icon" type="image/png" href={asset("/favicon.png")} />
24
- <link rel="stylesheet" href="/styles.css" />
23
+ <link rel="stylesheet" href={asset("/styles.css")} />
25
24
  </head>
26
25
  <body class="leading-8 flex flex-1 flex-col font-normal text-lg sm:leading-7 m-0 bg-black-lighter">
27
26
  <Header />
routes/_middleware.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { FreshContext } from "$fresh/server.ts";
2
+ import { createReporter } from "https://deno.land/x/g_a/mod.ts";
3
+
4
+ const report = createReporter({
5
+ id: "UA-31541587-1",
6
+ });
7
+
8
+ export async function handler(req: Request, ctx: FreshContext) {
9
+ const start = performance.now();
10
+ const resp = await ctx.next();
11
+ report(req, { remoteAddr: ctx.remoteAddr }, resp, start, null);
12
+ return resp;
13
+ }
routes/index.tsx CHANGED
@@ -1,20 +1,15 @@
1
1
  import { useSignal } from "@preact/signals";
2
2
  import { Handlers } from "$fresh/server.ts";
3
3
  import Slide from "../components/Slide.tsx";
4
+ import ProjectsIcon from "../components/icons/ProjectsIcon.tsx";
4
- import Counter from "../islands/Counter.tsx";
5
+ import TreeIcon from "../components/icons/TreeIcon.tsx";
6
+ import ContactIcon from "../components/icons/ContactIcon.tsx";
5
7
  import { asset, Head } from "$fresh/runtime.ts";
6
8
 
7
9
  export const handler: Handlers = {
8
10
  async GET(req, ctx) {
9
11
  return await ctx.render();
10
12
  },
11
- async POST(req, ctx) {
12
- const form = await req.formData();
13
- return new Response(null, {
14
- status: 303,
15
- headers: { location: "/" },
16
- });
17
- },
18
13
  };
19
14
 
20
15
  export default function Home() {
@@ -53,8 +48,8 @@ export default function Home() {
53
48
  </p>
54
49
  </div>
55
50
  <div>
56
- <div class="flex items-center mt-4 mb-4">
51
+ <div class="flex items-center mt-8 mb-4 [&>svg]:mr-2">
57
- {/* <Icon name="ant-design:project-outlined" /> */}
52
+ <ProjectsIcon size="36" />
58
53
  <h2 class="my-0 text-3xl font-bold">Projects</h2>
59
54
  </div>
60
55
  <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 sm:gap-8">
@@ -122,8 +117,8 @@ export default function Home() {
122
117
  </p>
123
118
  </Slide>
124
119
  <section class="flex flex-col flex-1">
125
- <div class="text-3xl font-bold">
120
+ <div class="flex text-3xl font-bold child-svg:mr-2">
126
- {/* <Icon name="typcn:tree" /> */}
121
+ <TreeIcon size="36" />
127
122
  Interests
128
123
  </div>
129
124
  <div class="ml-1 mt-6 mb-4">
@@ -145,30 +140,29 @@ export default function Home() {
145
140
  </ul>
146
141
  </section>
147
142
  <section class="flex flex-col flex-1">
148
- <div class="text-3xl font-bold">
143
+ <div class="flex text-3xl font-bold child-svg:mr-2">
149
- {/* <Icon name="mdi:contact-outline" /> */}
144
+ <ContactIcon size="36" />
150
145
  Contact
151
146
  </div>
152
147
  <div class="ml-1 mt-6 mb-4">
153
148
  You can contact me through any of these methods
154
149
  </div>
155
- <ul class="grid gap-1 grid-cols-1 ml-4 [&>li]:list-disc [&>li]:px-0 [&>li]:py-1 [&>a]:ml-4">
150
+ <div class="child:flex child:mb-3 child:ml-2 heir-a:ml-4 heir-a:text-blue">
156
- <li>
151
+ <div>
157
152
  Email:
158
153
  <a href="mailto:pyros2097@gmail.com">pyros2097@gmail.com</a>
159
- </li>
154
+ </div>
160
- <li>
155
+ <div>
161
156
  Github:
162
157
  <a href="https://github.com/pyrossh">pyrossh</a>
163
- </li>
158
+ </div>
164
- <li>
159
+ <div>
165
160
  LinkedIn:
166
161
  <a href="https://www.linkedin.com/in/peter-john-in">
167
- {" "}
168
162
  pyrossh
169
163
  </a>
170
- </li>
164
+ </div>
171
- </ul>
165
+ </div>
172
166
  </section>
173
167
  </div>
174
168
  </div>
static/favicon.ico DELETED
Binary file
static/favicon.png ADDED
Binary file
tailwind.config.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { type Config } from "tailwindcss";
2
+ import children from "tailwind-children";
2
3
 
3
4
  export default {
5
+ plugins: [children],
4
6
  content: ["{routes,islands,components}/**/*.{ts,tsx}"],
5
7
  theme: {
6
8
  fontFamily: {