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

Add Website Field to Project Section #137

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
16 changes: 14 additions & 2 deletions src/app/components/Resume/ResumePDF/ResumePDFProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ import {
} from "components/Resume/ResumePDF/common";
import { styles, spacing } from "components/Resume/ResumePDF/styles";
import type { ResumeProject } from "lib/redux/types";
import { ResumePDFLink } from "components/Resume/ResumePDF/common";

const getProjectName = (project: string, url: string) => {
return url.length === 0 ? (
<ResumePDFText bold={true}>{project}</ResumePDFText>
) : (
<ResumePDFLink src={url} isPDF={false}>
<ResumePDFText bold={true}>{project}</ResumePDFText>
</ResumePDFLink>
);
};

export const ResumePDFProject = ({
heading,
Expand All @@ -18,15 +29,16 @@ export const ResumePDFProject = ({
}) => {
return (
<ResumePDFSection themeColor={themeColor} heading={heading}>
{projects.map(({ project, date, descriptions }, idx) => (
{projects.map(({ project, url, date, descriptions }, idx) => (
<View key={idx}>
<View
style={{
...styles.flexRowBetween,
marginTop: spacing["0.5"],
}}
>
<ResumePDFText bold={true}>{project}</ResumePDFText>
{getProjectName(project, url)}
Copy link
Author

Choose a reason for hiding this comment

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

I am opening to refactor this part.


<ResumePDFText>{date}</ResumePDFText>
</View>
<View style={{ ...styles.flexCol, marginTop: spacing["0.5"] }}>
Expand Down
14 changes: 11 additions & 3 deletions src/app/components/ResumeForm/ProjectsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ export const ProjectsForm = () => {

return (
<Form form="projects" addButtonText="Add Project">
{projects.map(({ project, date, descriptions }, idx) => {
{projects.map(({ project, url, date, descriptions }, idx) => {
const handleProjectChange = (
...[
field,
value,
]: CreateHandleChangeArgsWithDescriptions<ResumeProject>
) => {
dispatch(changeProjects({ idx, field, value } as any));
dispatch(changeProjects({ idx, field, url, value } as any));
};
const showMoveUp = idx !== 0;
const showMoveDown = idx !== projects.length - 1;
Expand All @@ -43,7 +43,7 @@ export const ProjectsForm = () => {
placeholder="OpenResume"
value={project}
onChange={handleProjectChange}
labelClassName="col-span-4"
labelClassName="col-span-full"
/>
<Input
name="date"
Expand All @@ -53,6 +53,14 @@ export const ProjectsForm = () => {
onChange={handleProjectChange}
labelClassName="col-span-2"
/>
<Input
label="Website"
labelClassName="col-span-4"
name="url"
placeholder="github.com/xitanggg/open-resume"
value={url}
onChange={handleProjectChange}
/>
<BulletListTextarea
name="descriptions"
label="Description"
Expand Down
1 change: 1 addition & 0 deletions src/app/lib/redux/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface ResumeEducation {
export interface ResumeProject {
project: string;
date: string;
url: string;
descriptions: string[];
}

Expand Down