diff --git a/components/Badge.jsx b/components/Badge.tsx
similarity index 100%
rename from components/Badge.jsx
rename to components/Badge.tsx
diff --git a/components/Entry.jsx b/components/Entry.tsx
similarity index 100%
rename from components/Entry.jsx
rename to components/Entry.tsx
diff --git a/components/Footer.jsx b/components/Footer.tsx
similarity index 100%
rename from components/Footer.jsx
rename to components/Footer.tsx
diff --git a/components/Header.jsx b/components/Header.tsx
similarity index 77%
rename from components/Header.jsx
rename to components/Header.tsx
index d2e9344..bd1c5aa 100644
--- a/components/Header.jsx
+++ b/components/Header.tsx
@@ -1,8 +1,8 @@
-import Link from "next/link"
-import Toggle from "./Toggle"
-import TabBar from "./TabBar"
import { useTheme } from "next-themes"
+import Link from "next/link"
import { useRouter } from "next/router"
+import TabBar from "./TabBar"
+import Toggle from "./Toggle"
export default function Header() {
const router = useRouter()
@@ -47,18 +47,20 @@ export default function Header() {
)
diff --git a/components/Heading.jsx b/components/Heading.tsx
similarity index 85%
rename from components/Heading.jsx
rename to components/Heading.tsx
index 76af653..5c72d31 100644
--- a/components/Heading.jsx
+++ b/components/Heading.tsx
@@ -1,5 +1,5 @@
export default function Heading({ tag, children }) {
- const HTag = `${tag}`
+ const HTag = `${tag}` as keyof JSX.IntrinsicElements
const anchor = getAnchor(children)
const link = `#${anchor}`
return (
@@ -16,7 +16,7 @@ export default function Heading({ tag, children }) {
)
}
-function getAnchor(text) {
+function getAnchor(text: string): string {
return text
.toLowerCase()
.replace(/[^a-z0-9 ]/g, "")
diff --git a/components/Layout.jsx b/components/Layout.tsx
similarity index 100%
rename from components/Layout.jsx
rename to components/Layout.tsx
diff --git a/components/Post.jsx b/components/Post.tsx
similarity index 82%
rename from components/Post.jsx
rename to components/Post.tsx
index 78b6875..37deb84 100644
--- a/components/Post.jsx
+++ b/components/Post.tsx
@@ -1,6 +1,7 @@
-import Title from "../components/Title"
-import Layout from "../components/Layout"
-import PostCard from "../components/PostCard"
+import { Post as PostType } from "../lib/types"
+import Layout from "./Layout"
+import PostCard from "./PostCard"
+import Title from "./Title"
export default function Post({ meta, children }) {
return (
@@ -32,7 +33,7 @@ export default function Post({ meta, children }) {
)
}
-export function getPostBySlug(slug) {
+export function getPostBySlug(slug: string): PostType {
const post = require(`../pages/blog/${slug}.mdx`)
return {
diff --git a/components/PostCard.jsx b/components/PostCard.tsx
similarity index 100%
rename from components/PostCard.jsx
rename to components/PostCard.tsx
diff --git a/components/SkillCard.jsx b/components/SkillCard.tsx
similarity index 100%
rename from components/SkillCard.jsx
rename to components/SkillCard.tsx
diff --git a/components/TabBar.jsx b/components/TabBar.tsx
similarity index 100%
rename from components/TabBar.jsx
rename to components/TabBar.tsx
diff --git a/components/Title.jsx b/components/Title.tsx
similarity index 93%
rename from components/Title.jsx
rename to components/Title.tsx
index 31139b8..a5fc50a 100644
--- a/components/Title.jsx
+++ b/components/Title.tsx
@@ -11,7 +11,7 @@ export default function Title({ meta }) {
})}
- {meta.tags.map((tag) => {
+ {meta.tags.map((tag: string) => {
return (
{tag}
diff --git a/components/Toggle.jsx b/components/Toggle.tsx
similarity index 97%
rename from components/Toggle.jsx
rename to components/Toggle.tsx
index a4b3e86..4f1c324 100644
--- a/components/Toggle.jsx
+++ b/components/Toggle.tsx
@@ -2,7 +2,6 @@ export default function Toggle({ id, alt, onClick }) {
return (
-
-
-
-
-
- )
- }
-}
-
-export default MyDocument
diff --git a/pages/_app.js b/pages/_document.tsx
similarity index 52%
rename from pages/_app.js
rename to pages/_document.tsx
index 8a91e75..a087e44 100644
--- a/pages/_app.js
+++ b/pages/_document.tsx
@@ -1,11 +1,9 @@
-import Head from "next/head"
+import { Head, Html, Main, NextScript } from "next/document"
import Script from "next/script"
-import { ThemeProvider } from "next-themes"
-import "../styles/globals.css"
-export default function App({ Component, pageProps }) {
+export default function Document() {
return (
- <>
+
{/* Favicons */}
-
-
-
-
-
-
-
-
-
- >
+
+
+
+
+
+
+
+
+
+
+
)
}
diff --git a/pages/about.js b/pages/about.tsx
similarity index 100%
rename from pages/about.js
rename to pages/about.tsx
diff --git a/pages/blog.js b/pages/blog.tsx
similarity index 84%
rename from pages/blog.js
rename to pages/blog.tsx
index 83fb43d..ede10d5 100644
--- a/pages/blog.js
+++ b/pages/blog.tsx
@@ -1,7 +1,9 @@
+import type { GetStaticProps } from "next"
import Entry from "../components/Entry"
import Layout from "../components/Layout"
import PostCard from "../components/PostCard"
import { getAllPosts } from "../lib/posts"
+import { Post } from "../lib/types"
export default function Blog({ posts, postCount, postsByYear, years }) {
return (
@@ -23,13 +25,13 @@ export default function Blog({ posts, postCount, postsByYear, years }) {
})}
- {years.map((year) => {
+ {years.map((year: string) => {
return (
{year}
- {postsByYear[year].map((post) => {
+ {postsByYear[year].map((post: Post) => {
return
})}
@@ -41,7 +43,8 @@ export default function Blog({ posts, postCount, postsByYear, years }) {
)
}
-export async function getStaticProps() {
+// export async function getStaticProps() {
+export const getStaticProps: GetStaticProps = async () => {
const posts = getAllPosts().reverse()
const postCount = posts.length
let postsByYear = {}
@@ -58,7 +61,7 @@ export async function getStaticProps() {
}
}
-export function getFeaturedPosts(posts) {
+export function getFeaturedPosts(posts: Post[]): Post[] {
const featured = ["twitt3r", "tech-stack"]
const sorted = posts
diff --git a/pages/blog/tech-stack.mdx b/pages/blog/tech-stack.mdx
index d4f8a47..c103502 100644
--- a/pages/blog/tech-stack.mdx
+++ b/pages/blog/tech-stack.mdx
@@ -3,7 +3,7 @@
import Image from "next/image"
import Post from "../../components/Post"
import banner from "../../public/images/stack.png"
-import Badge from "../../components/Badge.jsx"
+import Badge from "../../components/Badge.tsx"
export const meta = {
title: "Building This Blog",
diff --git a/pages/contact.js b/pages/contact.tsx
similarity index 90%
rename from pages/contact.js
rename to pages/contact.tsx
index ff78022..138e783 100644
--- a/pages/contact.js
+++ b/pages/contact.tsx
@@ -20,23 +20,22 @@ export default function Contact() {
className="form"
type="email"
name="_replyto"
- tabIndex="1"
+ tabIndex={1}
placeholder="Email address"
required
/>
diff --git a/pages/index.js b/pages/index.tsx
similarity index 97%
rename from pages/index.js
rename to pages/index.tsx
index 1c64a01..18ef130 100644
--- a/pages/index.js
+++ b/pages/index.tsx
@@ -1,9 +1,11 @@
+import type { GetStaticProps } from "next"
import Link from "next/link"
import Accordion from "../components/Accordion"
import Badge from "../components/Badge"
import Layout from "../components/Layout"
import SkillCard from "../components/SkillCard"
import { getJobs } from "../lib/jobs"
+import { Job } from "../lib/types"
export default function Home({ jobs }) {
return (
@@ -167,6 +169,7 @@ export default function Home({ jobs }) {
Languages I know:
{[
+ "TypeScript",
"Solidity",
"Python",
"Terraform",
@@ -213,7 +216,7 @@ export default function Home({ jobs }) {
- {jobs.map((job) => {
+ {jobs.map((job: Job) => {
return
})}
@@ -240,7 +243,8 @@ export default function Home({ jobs }) {
)
}
-export async function getStaticProps() {
+// export async function getStaticProps() {
+export const getStaticProps: GetStaticProps = async () => {
const jobs = getJobs()
return {
diff --git a/public/logos/typescript.svg b/public/logos/typescript.svg
new file mode 100644
index 0000000..313e5e7
--- /dev/null
+++ b/public/logos/typescript.svg
@@ -0,0 +1,7 @@
+
+
diff --git a/tailwind.config.js b/tailwind.config.js
index 4de6736..4035c2c 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -1,6 +1,6 @@
module.exports = {
mode: "jit",
- content: ["./pages/**/*.js", "./pages/**/*.mdx", "./components/**/*.jsx"],
+ content: ["./pages/**/*{.ts,tsx,mdx}", "./components/**/*.tsx"],
safelist: ["opacity-0", "animate-fade-in"],
darkMode: "class",
theme: {
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..281d072
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,20 @@
+{
+ "compilerOptions": {
+ "target": "es2015",
+ "lib": ["dom", "dom.iterable", "esnext"],
+ "allowJs": true,
+ "skipLibCheck": true,
+ "strict": false,
+ "forceConsistentCasingInFileNames": true,
+ "noEmit": true,
+ "incremental": true,
+ "esModuleInterop": true,
+ "module": "esnext",
+ "moduleResolution": "node",
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "jsx": "preserve"
+ },
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
+ "exclude": ["node_modules"]
+}