diff --git a/components/Heading.tsx b/components/Heading.tsx
index 1bc9db7..5c72d31 100644
--- a/components/Heading.tsx
+++ b/components/Heading.tsx
@@ -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/Post.tsx b/components/Post.tsx
index 65888fd..37deb84 100644
--- a/components/Post.tsx
+++ b/components/Post.tsx
@@ -1,3 +1,4 @@
+import { Post as PostType } from "../lib/types"
import Layout from "./Layout"
import PostCard from "./PostCard"
import Title from "./Title"
@@ -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/Title.tsx b/components/Title.tsx
index 31139b8..a5fc50a 100644
--- a/components/Title.tsx
+++ 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/lib/jobs.ts b/lib/jobs.ts
index b8ca0ad..cb7c2c5 100644
--- a/lib/jobs.ts
+++ b/lib/jobs.ts
@@ -1,9 +1,10 @@
import fs from "fs"
import path from "path"
+import { Job } from "./types"
const dataDirectory = path.join(process.cwd(), "/public/data")
-export function getJobs() {
+export function getJobs(): Job[] {
const file = fs.readFileSync(dataDirectory + "/jobs.json").toString()
const jobs = JSON.parse(file)
diff --git a/lib/posts.ts b/lib/posts.ts
index 123d483..2f207c3 100644
--- a/lib/posts.ts
+++ b/lib/posts.ts
@@ -1,9 +1,10 @@
import fs from "fs"
import path from "path"
+import { Post } from "./types"
const postDirectory = path.join(process.cwd(), "/pages/blog")
-export function getAllPosts() {
+export function getAllPosts(): Post[] {
const files = fs.readdirSync(postDirectory)
const posts = files.map((file) => {
const post = require(`../pages/blog/${file}`)
@@ -13,6 +14,6 @@ export function getAllPosts() {
...post.meta,
}
})
-
+ console.log(posts)
return posts
}
diff --git a/lib/types.ts b/lib/types.ts
new file mode 100644
index 0000000..e5e9fcd
--- /dev/null
+++ b/lib/types.ts
@@ -0,0 +1,23 @@
+export type Job = {
+ id: number
+ company: string
+ title: string
+ startDate: string
+ endDate: string
+ location: string
+ image: string
+ skills: string[]
+ description: string
+}
+
+export type Post = {
+ slug: string
+ title: string
+ description: string
+ date: string
+ tags: string[]
+ image: string
+ alt: string
+ icon: string
+ related: string
+}
diff --git a/pages/_document.tsx b/pages/_document.tsx
index 78151b1..a087e44 100644
--- a/pages/_document.tsx
+++ b/pages/_document.tsx
@@ -1,75 +1,62 @@
-import Document, { Head, Html, Main, NextScript } from "next/document"
+import { Head, Html, Main, NextScript } from "next/document"
import Script from "next/script"
-class MyDocument extends Document {
- static async getInitialProps(ctx) {
- const initialProps = await Document.getInitialProps(ctx)
- return { ...initialProps }
- }
-
- render() {
- return (
-
-
- {/* Favicons */}
-
-
-
-
-
-
-
- {/* Preconnects */}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- )
- }
+export default function Document() {
+ return (
+
+
+ {/* Favicons */}
+
+
+
+
+
+
+
+ {/* Preconnects */}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
}
-
-export default MyDocument
diff --git a/pages/blog.tsx b/pages/blog.tsx
index e8fd0fe..ede10d5 100644
--- a/pages/blog.tsx
+++ b/pages/blog.tsx
@@ -3,6 +3,7 @@ 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 (
@@ -24,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
})}
@@ -60,7 +61,7 @@ export const getStaticProps: GetStaticProps = async () => {
}
}
-export function getFeaturedPosts(posts) {
+export function getFeaturedPosts(posts: Post[]): Post[] {
const featured = ["twitt3r", "tech-stack"]
const sorted = posts
diff --git a/pages/index.tsx b/pages/index.tsx
index d0ac419..18ef130 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -5,6 +5,7 @@ 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 (
@@ -168,8 +169,8 @@ export default function Home({ jobs }) {
Languages I know:
{[
- "Solidity",
"TypeScript",
+ "Solidity",
"Python",
"Terraform",
"Java",
@@ -215,7 +216,7 @@ export default function Home({ jobs }) {
- {jobs.map((job) => {
+ {jobs.map((job: Job) => {
return
})}
diff --git a/public/scripts/fade-in.js b/public/scripts/fade-in.js
index 50ce5a7..b4a2616 100644
--- a/public/scripts/fade-in.js
+++ b/public/scripts/fade-in.js
@@ -1,4 +1,4 @@
-export async function fadeIn() {
+async function fadeIn() {
const entries = document.querySelectorAll(".fade, .animate-fade-in")
const options = {
root: null,
diff --git a/public/scripts/update-selector.js b/public/scripts/update-selector.js
index e37fd16..fe09d74 100644
--- a/public/scripts/update-selector.js
+++ b/public/scripts/update-selector.js
@@ -1,4 +1,4 @@
-export async function updateSelector() {
+async function updateSelector() {
const classes = [
"translate-x-0",
"translate-x-full",