Skip to content

Commit

Permalink
Merge pull request #6 from flyhaozi:projs-blogs
Browse files Browse the repository at this point in the history
Improve projects & blog page
  • Loading branch information
yuhaofe authored Sep 26, 2021
2 parents 6e1762c + 340053c commit 2227eb1
Show file tree
Hide file tree
Showing 14 changed files with 238 additions and 144 deletions.
15 changes: 15 additions & 0 deletions components/layout.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
import Head from 'next/head'
import Header from './header'
import Footer from './footer'
import styles from '../styles/Layout.module.css'

export default function Layout({ children }) {
// https://nextjs.org/docs/api-reference/next/head
return (
<>
<Head >
<title>fHz | fly through the waves</title>
<meta name="description" content="fly through the waves" />
<meta property="og:title" content="fHz" key="title" />
<meta property="og:description" content="fly through the waves" key="description" />
<meta property="og:type" content="website" key="type" />
<meta property="og:url" content="https://flyhaozi.com/" key="url" />
<meta property="og:image" content="https://flyhaozi.com/banner.jpg" key="image" />
<meta name="twitter:card" content="summary_large_image" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
</Head>
<Header />
<main className={styles.children}>{children}</main>
<Footer />
Expand Down
30 changes: 12 additions & 18 deletions pages/[project].js
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,27 @@ export default function Project({ source, frontMatter }) {
return (
<>
<Head >
<title>{frontMatter.title}</title>
<title>{frontMatter.title + " | fHz"}</title>
<meta name="description" content={frontMatter.description} />
<meta property="og:title" content={frontMatter.title} />
<meta property="og:description" content={frontMatter.description} />
<meta property="og:type" content="website" />
<meta property="og:url" content={"https://flyhaozi.com/" + frontMatter.path} />
<meta property="og:image" content="https://flyhaozi.com/banner.jpg" />
<meta name="twitter:card" content="summary_large_image" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<meta property="og:title" content={frontMatter.title + " | fHz"} key="title" />
<meta property="og:description" content={frontMatter.description} key="description" />
<meta property="og:url" content={"https://flyhaozi.com/" + frontMatter.path} key="url" />
</Head>
<div className={cstyles.top}>
<h1>{frontMatter.title}</h1>
<p>{frontMatter.description}</p>
<div>
{frontMatter.links.map((link, index) => {
return <a href={link} target="_blank" key={index}>{
link.startsWith("https://chrome.google.com") &&
return <a href={link} target="_blank" key={index}>
{ link.startsWith("https://chrome.google.com") &&
<img src="/icons/chrome-web-store.svg" alt="Install from Chrome Web Store" />
} {link.startsWith("https://microsoftedge.microsoft.com") &&
} { link.startsWith("https://microsoftedge.microsoft.com") &&
<img src="/icons/microsoft-store.svg" alt="Get it from Microsoft" />
} {link.startsWith("https://greasyfork.org") &&
<img src="/icons/greasyfork.svg" alt="Install from Greasy Fork" />
} {link.startsWith("https://github.com") &&
<img src="/icons/github-white.svg" alt="View on Github" />
}
} { (link.startsWith("https://greasyfork.org") || link.startsWith("https://sleazyfork.org")) &&
<img src="/icons/greasyfork.svg" alt="Install from Greasy Fork" />
} { link.startsWith("https://github.com") &&
<img src="/icons/github-white.svg" alt="View on Github" />
}
</a>
})}
</div>
Expand Down
6 changes: 6 additions & 0 deletions pages/about.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import Head from 'next/head'
import cstyles from '../styles/Common.module.css'

export default function About() {
return (
<>
<Head >
<title>About | fHz</title>
<meta property="og:title" content="About | fHz" key="title" />
<meta property="og:url" content="https://flyhaozi.com/about" key="url" />
</Head>
<article className={cstyles.section}>
<h2>About Me</h2>
<p>Hi, I am <em>Yuhao Feng</em>. fHz is the name I use to publish my works.</p>
Expand Down
13 changes: 11 additions & 2 deletions pages/blog.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import Head from 'next/head'
import Link from 'next/link'
import cstyles from '../styles/Common.module.css'

export default function Blog() {
return (
<section className={cstyles.section}>
<h2>Blog</h2>
<h2>Under Construction</h2>
<Head >
<title>Blog | fHz</title>
<meta property="og:title" content="Blog | fHz" key="title" />
<meta property="og:url" content="https://flyhaozi.com/blog" key="url" />
</Head>
<h2>Blog (Under Construction)</h2>
<ul className={cstyles.blogList}>
<li><span>2021-10-01</span><Link href="/blog/2021-national-day"><a >Celebrate The 2021 National Day!!! 🎉✨</a></Link></li>
</ul>
</section>
)
}
2 changes: 1 addition & 1 deletion pages/blog/2021-national-day.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default function Post() {
<>
<article className={cstyles.section}>
<h1>Celebrate The 2021 National Day!!! 🎉✨</h1>
<p><time datetime="2021-10-01 00:00">2021-10-01</time> by fHz</p>
<p><time dateTime="2021-10-01 00:00">2021-10-01</time> by fHz</p>
<img src="https://i.loli.net/2021/09/23/Cv3UPs8SBbFKrjq.jpg" alt="National Day Fireworks"/>
</article>
</>
Expand Down
113 changes: 53 additions & 60 deletions pages/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 52 additions & 2 deletions pages/projects.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,60 @@
import { promises as fs } from 'fs'
import matter from 'gray-matter'
import path from 'path'
import Link from 'next/link'
import Head from 'next/head'
import cstyles from '../styles/Common.module.css'

export default function Projects() {
export default function Projects({ projectInfos }) {
return (
<section className={cstyles.section}>
<Head >
<title>Projects | fHz</title>
<meta property="og:title" content="Projects | fHz" key="title" />
<meta property="og:url" content="https://flyhaozi.com/projects" key="url" />
</Head>
<h2>Projects</h2>
<h2>Under Construction</h2>
<div className={cstyles.cardContainer}>
{
projectInfos.map(info => {
return <Link href={'/' + info.path} key={info.path}>
<a className={cstyles.projectCard}>
<div className={cstyles.projectBasic}>
<div>
<p className={cstyles.projectType}>{info.type}</p>
<p className={cstyles.projectName}>{info.title}</p>
</div>
<img className={cstyles.projectImg}></img>
</div>
<p className={cstyles.projectDesc}>{info.description}</p>
</a>
</Link>
})
}
</div>
</section>
)
}

export async function getStaticProps(context) {
const projectsDir = path.join(process.cwd(), 'projects');
const projectNames = await fs.readdir(projectsDir);
const projectInfos = await Promise.all(projectNames.map(async name => {
const projPath = path.join(projectsDir, name);
const projSource = await fs.readFile(projPath, 'utf8');
const { data } = matter(projSource);
return data;
}));

if (!projectInfos) {
return {
notFound: true,
}
}

projectInfos.sort((p1, p2) => p1.order.localeCompare(p2.order));

return {
props: { projectInfos }
}
}
2 changes: 2 additions & 0 deletions projects/blank-new-tab-page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
path: blank-new-tab-page
title: Blank New Tab Page - White Smoke
description: A chrome extension replaces the default new tab page to a white smoke background blank page, which also supports dark mode.
type: Browser Extension
order: c
links:
- https://chrome.google.com/webstore/detail/blank-new-tab-page-white/jmbngnnlimnakiibacglaeflpghellfh
- https://microsoftedge.microsoft.com/addons/detail/kakgoomeaegcolfmaaogfmifnnmllpkm
Expand Down
2 changes: 2 additions & 0 deletions projects/idle-detection-bypasser.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
path: idle-detection-bypasser
title: Idle Detection Bypasser
description: Give a fake active response to the caller of the Idle Detection API.
type: Userscript
order: d
links:
- https://greasyfork.org/scripts/432878-idle-detection-bypasser
- https://github.com/flyhaozi/Idle-Detection-Bypasser
Expand Down
2 changes: 2 additions & 0 deletions projects/quick-bookmarks-menu.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
path: quick-bookmarks-menu
title: Quick Bookmarks Menu
description: A chrome extension gives you quick access to your bookmarks.
type: Browser Extension
order: a
links:
- https://chrome.google.com/webstore/detail/quick-bookmarks-menu/fkemipdcgbeknabedhecepcebhlnlhbf
- https://microsoftedge.microsoft.com/addons/detail/quick-bookmarks-menu/nipmnpfdiiloiegpkodghkbgnhedgmhj
Expand Down
17 changes: 17 additions & 0 deletions projects/twitter-nsfw-expander.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
path: twitter-nsfw-expander
title: NSFW Expander for Twitter
description: Expand NSFW contents and accounts on Twitter automatically without logging in.
type: Userscript
order: z
links:
- https://sleazyfork.org/scripts/428873-nsfw-expander-for-twitter
- https://github.com/flyhaozi/NSFW-Expander-for-Twitter
---
## NSFW Expander for Twitter
[![](https://img.shields.io/github/stars/flyhaozi/NSFW-Expander-for-Twitter?style=social)](https://github.com/flyhaozi/NSFW-Expander-for-Twitter)

This script expands NSFW contents and accounts on Twitter automatically without logging in.

## ⚠ Caution
The script will ignore your sensitivity settings when you are logged in, please disable it when you are at work.
2 changes: 2 additions & 0 deletions projects/twitter-video-fixer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
path: twitter-video-fixer
title: Video Quality Fixer for Twitter
description: Force highest quality playback for Twitter videos.
type: Userscript
order: b
links:
- https://greasyfork.org/scripts/399827-video-quality-fixer-for-twitter
- https://github.com/flyhaozi/Video-Quality-Fixer-for-Twitter
Expand Down
Loading

0 comments on commit 2227eb1

Please sign in to comment.