From 0b620a344f20901ad1582740d2fc3197dfc66daa Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Fri, 29 Dec 2023 19:17:02 -0600 Subject: [PATCH] convert some more components to typescript --- components/Job.js | 14 ---------- components/Job.tsx | 22 +++++++++++++++ components/{Project.js => Project.tsx} | 8 +++++- components/Skill.js | 8 ------ components/Skill.tsx | 15 ++++++++++ pages/index.tsx | 38 ++++++++++++++++++-------- 6 files changed, 70 insertions(+), 35 deletions(-) delete mode 100644 components/Job.js create mode 100644 components/Job.tsx rename components/{Project.js => Project.tsx} (75%) delete mode 100644 components/Skill.js create mode 100644 components/Skill.tsx diff --git a/components/Job.js b/components/Job.js deleted file mode 100644 index 64bb7b5..0000000 --- a/components/Job.js +++ /dev/null @@ -1,14 +0,0 @@ -export default function Job({ logo, name, details, dateFrom, dateTo }) { - return ( -
- -
-
- {name} - {dateFrom} - {dateTo} -
- {details} -
-
- ) -} diff --git a/components/Job.tsx b/components/Job.tsx new file mode 100644 index 0000000..f7eb029 --- /dev/null +++ b/components/Job.tsx @@ -0,0 +1,22 @@ +export interface JobProps { + logo: string + name: string + details: string + dateFrom: string + dateTo: string +} + +export default function Job({ logo, name, details, dateFrom, dateTo }: JobProps) { + return ( +
+ +
+
+ {name} + {dateFrom} - {dateTo} +
+ {details} +
+
+ ) +} diff --git a/components/Project.js b/components/Project.tsx similarity index 75% rename from components/Project.js rename to components/Project.tsx index d7a1fe5..611ed5e 100644 --- a/components/Project.js +++ b/components/Project.tsx @@ -1,6 +1,12 @@ import ExternalLinkIcon from "./ExternalLinkIcon"; -export default function Project({ label, date, url }) { +export interface ProjectProps { + label: string + date: string + url: string +} + +export default function Project({ label, date, url }: ProjectProps) { return (

{label}

diff --git a/components/Skill.js b/components/Skill.js deleted file mode 100644 index 53bc2cf..0000000 --- a/components/Skill.js +++ /dev/null @@ -1,8 +0,0 @@ -export default function Skill({ label, link = "#" }) { - return ( - -
{label}
-
- ) -} - diff --git a/components/Skill.tsx b/components/Skill.tsx new file mode 100644 index 0000000..fdf58aa --- /dev/null +++ b/components/Skill.tsx @@ -0,0 +1,15 @@ +export interface SkillProps { + label: string + link?: string +} + +export default function Skill({ label, link = "#" }: SkillProps) { + return ( + +
+ {label} +
+
+ ) +} + diff --git a/pages/index.tsx b/pages/index.tsx index 4dbc260..1e09827 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,11 +1,18 @@ -import Job from "../components/Job.js"; -import Skill from "../components/Skill.js"; -import Project from "../components/Project.js"; +import Job, { type JobProps } from "../components/Job"; +import Skill, { type SkillProps } from "../components/Skill"; +import Project, { type ProjectProps } from "../components/Project"; import Head from "next/head"; -import { UsefulLinksList } from '../components/UsefulLinks/index.js' -import { SocialLinksList } from '../components/SocialLinks/SocialLinks.js' +import { UsefulLinksList } from '../components/UsefulLinks/index' +import { SocialLinksList } from '../components/SocialLinks/SocialLinks' +import type { InferGetStaticPropsType, GetStaticProps } from 'next' -export default function Landing({ jobs, skills, projects }) { +interface LandingProps { + jobs: JobsType[] + skills: SkillsType[] + projects: ProjectsType[] +} + +export default function Landing({ jobs, skills, projects }: LandingProps) { return (
@@ -46,7 +53,7 @@ export default function Landing({ jobs, skills, projects }) {

Skills

- {skills.map(skill => )} + {skills.map(skill => )}
@@ -77,7 +84,11 @@ export default function Landing({ jobs, skills, projects }) { } -export function getStaticProps() { +export function getStaticProps(): ReturnType> { return { props: { projects: [ @@ -94,10 +105,10 @@ export function getStaticProps() { { label: "Armstrong Editor", date: "12/14/2022", url: "https://github.com/tristonarmstrong/armstrong-editor" }, ], skills: [ - { label: "Typescript", color: "blue-500" }, - { label: "Python", color: "green-800" }, - { label: "Rust", color: "yellow-800" }, - { label: "Javascript", color: "yellow-500" }, + { label: "Typescript" }, + { label: "Python" }, + { label: "Rust" }, + { label: "Javascript" }, ], jobs: [ { @@ -134,3 +145,6 @@ export function getStaticProps() { } +type SkillsType = SkillProps +type JobsType = JobProps +type ProjectsType = ProjectProps