Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add types, allow bullets for description #35

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from "react";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Card, CardHeader, CardContent } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
Expand Down Expand Up @@ -68,7 +69,10 @@ export default function Page() {
asChild
>
<a href={social.url}>
<social.icon className="h-4 w-4" />
{React.createElement(
social.icon as React.ComponentType<{ className: string }>,
{ className: "h-4 w-4" },
)}
Comment on lines +72 to +75
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the reason for this change? what was the error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only if we're adding types.
I'll remove this if types aren't necessary.

</a>
</Button>
))}
Expand Down Expand Up @@ -132,7 +136,20 @@ export default function Page() {
</h4>
</CardHeader>
<CardContent className="mt-2 text-xs">
{work.description}
{typeof work.description === "string" ? (
<p>{work.description}</p>
) : (
work.description?.map((desc) => {
return (
<p key={desc} className="mb-1">
<span className="mr-2">
{work?.customBullet || "•"}
</span>
{desc}
</p>
);
})
)}
</CardContent>
</Card>
);
Expand Down Expand Up @@ -177,7 +194,7 @@ export default function Page() {
title={project.title}
description={project.description}
tags={project.techStack}
link={"link" in project ? project.link.href : undefined}
link={"link" in project ? project.link?.href : undefined}
/>
);
})}
Expand Down
3 changes: 2 additions & 1 deletion src/data/resume-data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import {
YearProgressLogo,
} from "@/images/logos";
import { GitHubIcon, LinkedInIcon, XIcon } from "@/components/icons";
import { ResumeData } from "./resume-data.types";

export const RESUME_DATA = {
export const RESUME_DATA: ResumeData = {
name: "Bartosz Jarocki",
initials: "BJ",
location: "Wrocław, Poland, CET",
Expand Down
64 changes: 64 additions & 0 deletions src/data/resume-data.types.ts
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding types is going to cause a lot of problems for people who just want to fork the project and use it. some users may not have a project, websiteurl or don't want to put out location links etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how adding types would be a problem.
but you're right, people might not have everything. I'll see and change the types to optional for whatever is being conditionally rendered.

Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { StaticImageData } from "next/image";
export type ResumeData = {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having that adds pretty much no value but adds a lot of overhead In maintaining the type. using as const ensures we have a type to check against and I'd rather not include this change because of that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I added types is because exporting as const won't allow as much customization.

For Example:
If I have any desc with a field customBullet and i use it in the page.tsx it works fine, because the field exists.

if I remove the field from the config, we get this error Property 'customBullet' does not exist on type 'never'.

The app still works fine, but Vercel doesn't allow this.

and for possibility of making the desc both array or string, exporting as const won't allow it unless there's atleast one array and one string in the whole config, or it'll have the type never, and the deployment fails.

name: string;
initials: string;
location: string;
locationLink: string;
about: string;
summary: string;
avatarUrl: string;
personalWebsiteUrl: string;
contact: {
email: string;
tel: string;
social: {
name: string;
url: string;
icon: React.ComponentType;
}[];
};
education: {
school: string;
degree: string;
grade?: string;
start: string;
end: string;
}[];
work: {
company: string;
link: string;
badges: string[];
title: string;
logo: React.ComponentType<{}> | StaticImageData;
start: string;
end: string;
description: string | string[];
customBullet?: string;
}[];
skills: string[];
projects: {
title: string;
techStack: string[];
description: string;
logo: React.ComponentType<{}> | StaticImageData;
link?: {
label: string;
href: string;
};
}[];
certification?: {
name: string;
providerName: string;
link: string;
issueDate: string;
expirationDate: string;
certificateId: string;
}[];
publication?: {
name: string;
providerName: string;
link: string;
issueDate: string;
description: string;
}[];
};