Skip to content

added profile section show, hide and movable #130

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

Open
wants to merge 3 commits 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
12 changes: 7 additions & 5 deletions src/app/components/Resume/ResumePDF/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ export const ResumePDF = ({
const showFormsOrder = formsOrder.filter((form) => formToShow[form]);

const formTypeToComponent: { [type in ShowForm]: () => JSX.Element } = {
profile: () => (
<ResumePDFProfile
profile={profile}
themeColor={themeColor}
isPDF={isPDF}
/>
),
workExperiences: () => (
<ResumePDFWorkExperience
heading={formToHeading["workExperiences"]}
Expand Down Expand Up @@ -119,11 +126,6 @@ export const ResumePDF = ({
padding: `${spacing[0]} ${spacing[20]}`,
}}
>
<ResumePDFProfile
profile={profile}
themeColor={themeColor}
isPDF={isPDF}
/>
{showFormsOrder.map((form) => {
const Component = formTypeToComponent[form];
return <Component key={form} />;
Expand Down
1 change: 1 addition & 0 deletions src/app/components/ResumeForm/Form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const BaseForm = ({
);

const FORM_TO_ICON: { [section in ShowForm]: typeof BuildingOfficeIcon } = {
profile: BuildingOfficeIcon,
workExperiences: BuildingOfficeIcon,
educations: AcademicCapIcon,
projects: LightBulbIcon,
Expand Down
26 changes: 26 additions & 0 deletions src/app/components/ResumeForm/ProfileForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,44 @@ import { BaseForm } from "components/ResumeForm/Form";
import { Input, Textarea } from "components/ResumeForm/Form/InputGroup";
import { useAppDispatch, useAppSelector } from "lib/redux/hooks";
import { changeProfile, selectProfile } from "lib/redux/resumeSlice";
import { changeFormOrder, changeShowForm, selectIsFirstForm, selectIsLastForm, selectShowByForm, ShowForm } from "lib/redux/settingsSlice";
import { ResumeProfile } from "lib/redux/types";
import { MoveIconButton, ShowIconButton } from "./Form/IconButton";

export const ProfileForm = () => {
const form = "profile";

const profile = useAppSelector(selectProfile);
const showForm = useAppSelector(selectShowByForm(form));
const dispatch = useAppDispatch();
const { name, email, phone, url, summary, location } = profile;

const isFirstForm = useAppSelector(selectIsFirstForm(form));
const isLastForm = useAppSelector(selectIsLastForm(form));

const setShowForm = (showForm: boolean) => {
dispatch(changeShowForm({ field: form, value: showForm }));
};

const handleMoveClick = (type: "up" | "down") => {
dispatch(changeFormOrder({ form, type }));
};

const handleProfileChange = (field: keyof ResumeProfile, value: string) => {
dispatch(changeProfile({ field, value }));
};

return (
<BaseForm>
<div className="flex items-center justify-end gap-0.5">
{!isFirstForm && (
<MoveIconButton type="up" onClick={handleMoveClick} />
)}
{!isLastForm && (
<MoveIconButton type="down" onClick={handleMoveClick} />
)}
<ShowIconButton show={showForm} setShow={setShowForm} />
</div>
<div className="grid grid-cols-6 gap-3">
<Input
label="Name"
Expand Down Expand Up @@ -65,6 +90,7 @@ export const ProfileForm = () => {
onChange={handleProfileChange}
/>
</div>

</BaseForm>
);
};
2 changes: 1 addition & 1 deletion src/app/components/ResumeForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { FlexboxSpacer } from "components/FlexboxSpacer";
import { cx } from "lib/cx";

const formTypeToComponent: { [type in ShowForm]: () => JSX.Element } = {
profile : ProfileForm,
workExperiences: WorkExperiencesForm,
educations: EducationsForm,
projects: ProjectsForm,
Expand All @@ -41,7 +42,6 @@ export const ResumeForm = () => {
onMouseLeave={() => setIsHover(false)}
>
<section className="flex max-w-2xl flex-col gap-8 p-[var(--resume-padding)]">
<ProfileForm />
{formsOrder.map((form) => {
const Component = formTypeToComponent[form];
return <Component key={form} />;
Expand Down
1 change: 1 addition & 0 deletions src/app/home/AutoTypingResume.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export const AutoTypingResume = () => {
...initialSettings,
fontSize: "12",
formToHeading: {
profile :"PROFILE",
workExperiences: resume.workExperiences[0].company
? "WORK EXPERIENCE"
: "",
Expand Down
6 changes: 5 additions & 1 deletion src/app/lib/redux/settingsSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ export interface Settings {
fontSize: string;
documentSize: string;
formToShow: {
profile: boolean;
workExperiences: boolean;
educations: boolean;
projects: boolean;
skills: boolean;
custom: boolean;
};
formToHeading: {
profile:string;
workExperiences: string;
educations: string;
projects: string;
Expand Down Expand Up @@ -47,20 +49,22 @@ export const initialSettings: Settings = {
fontSize: DEFAULT_FONT_SIZE,
documentSize: "Letter",
formToShow: {
profile:true,
workExperiences: true,
educations: true,
projects: true,
skills: true,
custom: false,
},
formToHeading: {
profile:"PROFILE",
workExperiences: "WORK EXPERIENCE",
educations: "EDUCATION",
projects: "PROJECT",
skills: "SKILLS",
custom: "CUSTOM SECTION",
},
formsOrder: ["workExperiences", "educations", "projects", "skills", "custom"],
formsOrder: ["profile","workExperiences", "educations", "projects", "skills", "custom"],
showBulletPoints: {
educations: true,
projects: true,
Expand Down