mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-13 00:03:27 +10:00
- implement awards section
This commit is contained in:
84
package-lock.json
generated
84
package-lock.json
generated
@ -2871,9 +2871,9 @@
|
||||
"integrity": "sha512-TiNg8R1kjDde5Pub9F9vCwZA/BNW9HeXP5b9j7Qucqncy/McfPZ6xze/EyBdXS5FhMIGN6Fx3vg75l5KHy3V1Q=="
|
||||
},
|
||||
"@types/glob": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.2.tgz",
|
||||
"integrity": "sha512-VgNIkxK+j7Nz5P7jvUZlRvhuPSmsEfS03b0alKcq5V/STUKAa3Plemsn5mrQUO7am6OErJ4rhGEGJbACclrtRA==",
|
||||
"version": "7.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz",
|
||||
"integrity": "sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w==",
|
||||
"requires": {
|
||||
"@types/minimatch": "*",
|
||||
"@types/node": "*"
|
||||
@ -6588,9 +6588,9 @@
|
||||
}
|
||||
},
|
||||
"devcert": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/devcert/-/devcert-1.1.1.tgz",
|
||||
"integrity": "sha512-4C1y6ZP9PFE1CK/Pgks4Qf1WA4rzJOtR2RJ7mkDfiQRixDNrtCkZiWvwSKb0AN830Dp4cgb+VLLi8eVWv7cC6A==",
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/devcert/-/devcert-1.1.2.tgz",
|
||||
"integrity": "sha512-B72N5Z2Lzu11dsPvg/KD9IwQCyNg6JgsNcHw7zJ+QQN9/rusMpc0tSSOYLczmty5D7vOs94IHITPQ0uei5D3cw==",
|
||||
"requires": {
|
||||
"@types/configstore": "^2.1.1",
|
||||
"@types/debug": "^0.0.30",
|
||||
@ -8568,9 +8568,9 @@
|
||||
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc="
|
||||
},
|
||||
"gatsby": {
|
||||
"version": "2.23.21",
|
||||
"resolved": "https://registry.npmjs.org/gatsby/-/gatsby-2.23.21.tgz",
|
||||
"integrity": "sha512-oR4E+v3ilih+hQ1KyDI9N9c5OUqpNyiw93vO2YCGnpIY+q2/ldUnjWQc9FLGgMxupNs9nnTtYT/UrpePHFQvzQ==",
|
||||
"version": "2.23.22",
|
||||
"resolved": "https://registry.npmjs.org/gatsby/-/gatsby-2.23.22.tgz",
|
||||
"integrity": "sha512-3kQUOeYZDle17tgvBD8DHIv2jjjKISV6c/+adRPxIBtcsA/zc+otrLXDD8PL77jd2xiE8X7/lMq2O4LsvOx+qQ==",
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.10.3",
|
||||
"@babel/core": "^7.10.3",
|
||||
@ -8633,11 +8633,11 @@
|
||||
"file-loader": "^1.1.11",
|
||||
"fs-exists-cached": "1.0.0",
|
||||
"fs-extra": "^8.1.0",
|
||||
"gatsby-cli": "^2.12.58",
|
||||
"gatsby-cli": "^2.12.59",
|
||||
"gatsby-core-utils": "^1.3.11",
|
||||
"gatsby-graphiql-explorer": "^0.4.10",
|
||||
"gatsby-link": "^2.4.11",
|
||||
"gatsby-plugin-page-creator": "^2.3.15",
|
||||
"gatsby-plugin-page-creator": "^2.3.16",
|
||||
"gatsby-plugin-typescript": "^2.4.13",
|
||||
"gatsby-react-router-scroll": "^3.0.10",
|
||||
"gatsby-telemetry": "^1.3.18",
|
||||
@ -8721,9 +8721,9 @@
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg=="
|
||||
},
|
||||
"gatsby-cli": {
|
||||
"version": "2.12.58",
|
||||
"resolved": "https://registry.npmjs.org/gatsby-cli/-/gatsby-cli-2.12.58.tgz",
|
||||
"integrity": "sha512-YyOaEKgbMdMZ6AcHkoSXBXyiIttYgshbToniSM0AMUZYqil/pm1V7ag+E82DMZJwjbDSiJ/WCfJ/bZeMUcsC1w==",
|
||||
"version": "2.12.59",
|
||||
"resolved": "https://registry.npmjs.org/gatsby-cli/-/gatsby-cli-2.12.59.tgz",
|
||||
"integrity": "sha512-iQPFgBbZG1dLGtdNqB/gsnlwWu44rli/4J2VzYU3zwPguC9Zo3KMQxnrbIRY6CB1ryWQl+m/FZxO4umkEk8IUg==",
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.10.3",
|
||||
"@babel/runtime": "^7.10.3",
|
||||
@ -8740,7 +8740,7 @@
|
||||
"fs-exists-cached": "^1.0.0",
|
||||
"fs-extra": "^8.1.0",
|
||||
"gatsby-core-utils": "^1.3.11",
|
||||
"gatsby-recipes": "^0.1.49",
|
||||
"gatsby-recipes": "^0.1.50",
|
||||
"gatsby-telemetry": "^1.3.18",
|
||||
"hosted-git-info": "^3.0.4",
|
||||
"ink": "^2.7.1",
|
||||
@ -8813,14 +8813,6 @@
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
|
||||
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="
|
||||
},
|
||||
"webpack-merge": {
|
||||
"version": "4.2.2",
|
||||
"resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-4.2.2.tgz",
|
||||
"integrity": "sha512-TUE1UGoTX2Cd42j3krGYqObZbOD+xF7u28WB7tfUordytSjbWTIjK/8V0amkBfTYN4/pB/GIDlJZZ657BGG19g==",
|
||||
"requires": {
|
||||
"lodash": "^4.17.15"
|
||||
}
|
||||
},
|
||||
"yallist": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
|
||||
@ -8870,9 +8862,9 @@
|
||||
}
|
||||
},
|
||||
"gatsby-page-utils": {
|
||||
"version": "0.2.15",
|
||||
"resolved": "https://registry.npmjs.org/gatsby-page-utils/-/gatsby-page-utils-0.2.15.tgz",
|
||||
"integrity": "sha512-Kbrs/K/wFLEiMfNG/ZNFYEM1oftSqUVJReC1CvwRsPE2T1iU/LiiubWRlOpAAEw3iuAHToasfwcJfv0T98u5/A==",
|
||||
"version": "0.2.16",
|
||||
"resolved": "https://registry.npmjs.org/gatsby-page-utils/-/gatsby-page-utils-0.2.16.tgz",
|
||||
"integrity": "sha512-9z+M8AS2YmSf5iw0AA+WuNeIgFpswbHRlV3K0BCfEIV7AZUKIW1oa7f7oWT3GRnN3r0Km/GfEgKQzQs81jX26g==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.10.3",
|
||||
"bluebird": "^3.7.2",
|
||||
@ -8948,14 +8940,14 @@
|
||||
}
|
||||
},
|
||||
"gatsby-plugin-page-creator": {
|
||||
"version": "2.3.15",
|
||||
"resolved": "https://registry.npmjs.org/gatsby-plugin-page-creator/-/gatsby-plugin-page-creator-2.3.15.tgz",
|
||||
"integrity": "sha512-+Q4r6Fg5hBW+Iz8iqZ7H9cm62IBdgUc4UBJeJbGyKL1pifSpVPMwSDv0VxiNinZDjA/GW6u7lB4dEdRBDsX16A==",
|
||||
"version": "2.3.16",
|
||||
"resolved": "https://registry.npmjs.org/gatsby-plugin-page-creator/-/gatsby-plugin-page-creator-2.3.16.tgz",
|
||||
"integrity": "sha512-3HK0K+9yotRypNSeM/d2PlhW3YnFrQQ7MKF79sGSEM5x++9RiXYB1YbjibNw5rsM0SI/YCQqAAJi86kNU0B3SQ==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.10.3",
|
||||
"bluebird": "^3.7.2",
|
||||
"fs-exists-cached": "^1.0.0",
|
||||
"gatsby-page-utils": "^0.2.15",
|
||||
"gatsby-page-utils": "^0.2.16",
|
||||
"glob": "^7.1.6",
|
||||
"lodash": "^4.17.15",
|
||||
"micromatch": "^3.1.10"
|
||||
@ -9190,9 +9182,9 @@
|
||||
}
|
||||
},
|
||||
"gatsby-recipes": {
|
||||
"version": "0.1.49",
|
||||
"resolved": "https://registry.npmjs.org/gatsby-recipes/-/gatsby-recipes-0.1.49.tgz",
|
||||
"integrity": "sha512-p+pRxZAlt6Kwfc8JolwkHu6O/QWDMMpDepS7a41N+H8CVju6EDNweMfvI1/hedcJ93nactUj6tsyxyyV/xMhFA==",
|
||||
"version": "0.1.50",
|
||||
"resolved": "https://registry.npmjs.org/gatsby-recipes/-/gatsby-recipes-0.1.50.tgz",
|
||||
"integrity": "sha512-z+a3a1g+zxZ1skYzLdhHJBQt02nfL+VIpGTXqryrvofA9V5cfZJ2INkgj6nebcB3atQjZxA33xq5GOwmOQi93Q==",
|
||||
"requires": {
|
||||
"@babel/core": "^7.10.3",
|
||||
"@babel/generator": "^7.10.3",
|
||||
@ -9286,9 +9278,9 @@
|
||||
}
|
||||
},
|
||||
"execa": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-4.0.2.tgz",
|
||||
"integrity": "sha512-QI2zLa6CjGWdiQsmSkZoGtDx2N+cQIGb3yNolGTdjSQzydzLgYYf8LRuagp7S7fPimjcrzUDSUFd/MgzELMi4Q==",
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-4.0.3.tgz",
|
||||
"integrity": "sha512-WFDXGHckXPWZX19t1kCsXzOpqX9LWYNqn4C+HqZlk/V0imTkzJZqf87ZBhvpHaftERYknpk0fjSylnXVlVgI0A==",
|
||||
"requires": {
|
||||
"cross-spawn": "^7.0.0",
|
||||
"get-stream": "^5.0.0",
|
||||
@ -9871,9 +9863,9 @@
|
||||
"integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU="
|
||||
},
|
||||
"graphql": {
|
||||
"version": "14.6.0",
|
||||
"resolved": "https://registry.npmjs.org/graphql/-/graphql-14.6.0.tgz",
|
||||
"integrity": "sha512-VKzfvHEKybTKjQVpTFrA5yUq2S9ihcZvfJAtsDBBCuV6wauPu1xl/f9ehgVf0FcEJJs4vz6ysb/ZMkGigQZseg==",
|
||||
"version": "14.7.0",
|
||||
"resolved": "https://registry.npmjs.org/graphql/-/graphql-14.7.0.tgz",
|
||||
"integrity": "sha512-l0xWZpoPKpppFzMfvVyFmp9vLN7w/ZZJPefUicMCepfJeQ8sMcztloGYY9DfjVPo6tIUDzU5Hw3MUbIjj9AVVA==",
|
||||
"requires": {
|
||||
"iterall": "^1.2.2"
|
||||
}
|
||||
@ -12260,9 +12252,9 @@
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.15",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
|
||||
"version": "4.17.17",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.17.tgz",
|
||||
"integrity": "sha512-/B2DjOphAoqi5BX4Gg2oh4UR0Gy/A7xYAMh3aSECEKzwS3eCDEpS0Cals1Ktvxwlal3bBJNc+5W9kNIcADdw5Q=="
|
||||
},
|
||||
"lodash-es": {
|
||||
"version": "4.17.15",
|
||||
@ -19724,6 +19716,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"webpack-merge": {
|
||||
"version": "4.2.2",
|
||||
"resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-4.2.2.tgz",
|
||||
"integrity": "sha512-TUE1UGoTX2Cd42j3krGYqObZbOD+xF7u28WB7tfUordytSjbWTIjK/8V0amkBfTYN4/pB/GIDlJZZ657BGG19g==",
|
||||
"requires": {
|
||||
"lodash": "^4.17.15"
|
||||
}
|
||||
},
|
||||
"webpack-sources": {
|
||||
"version": "1.4.3",
|
||||
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz",
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
"classnames": "^2.2.6",
|
||||
"firebase": "^7.15.5",
|
||||
"formik": "^2.1.4",
|
||||
"gatsby": "^2.23.21",
|
||||
"gatsby": "^2.23.22",
|
||||
"gatsby-image": "^2.4.12",
|
||||
"gatsby-plugin-create-client-paths": "^2.3.9",
|
||||
"gatsby-plugin-firebase": "^0.2.0-beta.4",
|
||||
@ -33,7 +33,7 @@
|
||||
"gatsby-source-filesystem": "^2.3.18",
|
||||
"gatsby-source-gravatar": "^1.0.0",
|
||||
"gatsby-transformer-sharp": "^2.5.10",
|
||||
"lodash": "^4.17.15",
|
||||
"lodash": "^4.17.17",
|
||||
"moment": "^2.27.0",
|
||||
"nanoevents": "^5.1.8",
|
||||
"react": "^16.13.1",
|
||||
|
||||
@ -65,8 +65,8 @@ const DoubleFieldListItem = ({
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<div className="flex flex-col">
|
||||
<span className="font-medium">{title}</span>
|
||||
<span className="mt-1 text-sm opacity-75">{subtitle}</span>
|
||||
<span className="font-medium truncate">{title}</span>
|
||||
<span className="mt-1 text-sm opacity-75 truncate">{subtitle}</span>
|
||||
</div>
|
||||
|
||||
<div className={styles.menu}>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
.container {
|
||||
@apply flex items-center justify-between border-t border-secondary px-8 py-5;
|
||||
@apply flex items-center justify-between border-t border-secondary px-6 py-5;
|
||||
}
|
||||
|
||||
.container:first-child {
|
||||
|
||||
@ -66,10 +66,10 @@ const TripleFieldListItem = ({
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<div className="grid">
|
||||
<span className="font-medium">{title}</span>
|
||||
<span className="mt-1 text-sm opacity-75">{subtitle}</span>
|
||||
<span className="font-medium truncate">{title}</span>
|
||||
<span className="mt-1 text-sm opacity-75 truncate">{subtitle}</span>
|
||||
|
||||
<span className="w-4/5 mt-6 text-sm opacity-75 truncate">{text}</span>
|
||||
<span className="w-4/5 mt-5 text-sm opacity-75 truncate">{text}</span>
|
||||
</div>
|
||||
|
||||
<div className={styles.menu}>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
.container {
|
||||
@apply flex items-center justify-between border-t border-secondary px-8 py-5;
|
||||
@apply flex items-center justify-between border-t border-secondary px-6 py-5;
|
||||
}
|
||||
|
||||
.container:first-child {
|
||||
|
||||
28
src/components/builder/sections/Awards.js
Normal file
28
src/components/builder/sections/Awards.js
Normal file
@ -0,0 +1,28 @@
|
||||
import { get } from "lodash";
|
||||
import React from "react";
|
||||
import Heading from "../../shared/Heading";
|
||||
import List from "../lists/List";
|
||||
import TripleFieldListItem from "../lists/triple/TripleFieldListItem";
|
||||
|
||||
const Awards = ({ id, name, event, state }) => {
|
||||
const path = `${id}.items`;
|
||||
const items = get(state, path, []);
|
||||
|
||||
return (
|
||||
<section>
|
||||
<Heading>{name}</Heading>
|
||||
|
||||
<List
|
||||
path={path}
|
||||
items={items}
|
||||
event={event}
|
||||
titlePath="title"
|
||||
subtitlePath="awarder"
|
||||
textPath="summary"
|
||||
listItemComponent={TripleFieldListItem}
|
||||
/>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
export default Awards;
|
||||
@ -18,6 +18,7 @@ const Input = ({
|
||||
checked,
|
||||
onChange,
|
||||
className,
|
||||
isRequired,
|
||||
placeholder,
|
||||
onDeleteItem,
|
||||
showDeleteItemButton,
|
||||
@ -42,7 +43,13 @@ const Input = ({
|
||||
return (
|
||||
<div className={cx(styles.container, className)}>
|
||||
<label htmlFor={uuid}>
|
||||
<span>{label}</span>
|
||||
<span>
|
||||
{label}{" "}
|
||||
{isRequired && (
|
||||
<span className="opacity-75 font-normal lowercase">(Required)</span>
|
||||
)}
|
||||
</span>
|
||||
|
||||
{type === "textarea" ? (
|
||||
<div className="flex flex-col">
|
||||
<textarea
|
||||
|
||||
10
src/constants/ModalEvents.js
Normal file
10
src/constants/ModalEvents.js
Normal file
@ -0,0 +1,10 @@
|
||||
const ModalEvents = {
|
||||
AUTH_MODAL: "auth_modal",
|
||||
CREATE_RESUME_MODAL: "create_resume_modal",
|
||||
SOCIAL_MODAL: "social_modal",
|
||||
WORK_MODAL: "work_modal",
|
||||
EDUCATION_MODAL: "education_modal",
|
||||
AWARD_MODAL: "award_modal",
|
||||
};
|
||||
|
||||
export default ModalEvents;
|
||||
@ -1,17 +1,10 @@
|
||||
import { createNanoEvents } from "nanoevents";
|
||||
import React, { createContext } from "react";
|
||||
|
||||
const MODAL_EVENTS = {
|
||||
AUTH_MODAL: "auth_modal",
|
||||
CREATE_RESUME_MODAL: "create_resume_modal",
|
||||
SOCIAL_MODAL: "social_modal",
|
||||
WORK_MODAL: "work_modal",
|
||||
EDUCATION_MODAL: "education_modal",
|
||||
};
|
||||
import ModalEvents from "../constants/ModalEvents";
|
||||
|
||||
const emitter = createNanoEvents();
|
||||
|
||||
const defaultState = { events: MODAL_EVENTS, emitter };
|
||||
const defaultState = { events: ModalEvents, emitter };
|
||||
|
||||
const ModalContext = createContext(defaultState);
|
||||
|
||||
@ -25,4 +18,4 @@ const ModalProvider = ({ children }) => {
|
||||
|
||||
export default ModalContext;
|
||||
|
||||
export { ModalProvider, MODAL_EVENTS };
|
||||
export { ModalProvider };
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
import { AiOutlineTwitter } from "react-icons/ai";
|
||||
import { FaAward } from "react-icons/fa";
|
||||
import { IoMdBriefcase, IoMdDocument } from "react-icons/io";
|
||||
import { MdPerson, MdSchool } from "react-icons/md";
|
||||
import Awards from "../components/builder/sections/Awards";
|
||||
import Education from "../components/builder/sections/Education";
|
||||
import Objective from "../components/builder/sections/Objective";
|
||||
import Profile from "../components/builder/sections/Profile";
|
||||
import Social from "../components/builder/sections/Social";
|
||||
import Work from "../components/builder/sections/Work";
|
||||
import { MODAL_EVENTS } from "../contexts/ModalContext";
|
||||
import ModalEvents from "../constants/ModalEvents";
|
||||
|
||||
export default [
|
||||
{
|
||||
@ -20,7 +22,7 @@ export default [
|
||||
name: "Social Network",
|
||||
icon: AiOutlineTwitter,
|
||||
component: Social,
|
||||
event: MODAL_EVENTS.SOCIAL_MODAL,
|
||||
event: ModalEvents.SOCIAL_MODAL,
|
||||
},
|
||||
{
|
||||
id: "objective",
|
||||
@ -33,13 +35,20 @@ export default [
|
||||
name: "Work Experience",
|
||||
icon: IoMdBriefcase,
|
||||
component: Work,
|
||||
event: MODAL_EVENTS.WORK_MODAL,
|
||||
event: ModalEvents.WORK_MODAL,
|
||||
},
|
||||
{
|
||||
id: "education",
|
||||
name: "Education",
|
||||
icon: MdSchool,
|
||||
component: Education,
|
||||
event: MODAL_EVENTS.EDUCATION_MODAL,
|
||||
event: ModalEvents.EDUCATION_MODAL,
|
||||
},
|
||||
{
|
||||
id: "awards",
|
||||
name: "Awards",
|
||||
icon: FaAward,
|
||||
component: Awards,
|
||||
event: ModalEvents.AWARD_MODAL,
|
||||
},
|
||||
];
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import React, { Fragment } from "react";
|
||||
import AuthModal from "./AuthModal";
|
||||
import ResumeModal from "./ResumeModal";
|
||||
import AwardModal from "./sections/AwardModal";
|
||||
import EducationModal from "./sections/EducationModal";
|
||||
import SocialModal from "./sections/SocialModal";
|
||||
import WorkModal from "./sections/WorkModal";
|
||||
@ -13,6 +14,7 @@ const ModalRegistrar = () => {
|
||||
<SocialModal />
|
||||
<WorkModal />
|
||||
<EducationModal />
|
||||
<AwardModal />
|
||||
</Fragment>
|
||||
);
|
||||
};
|
||||
|
||||
@ -3,8 +3,8 @@ import { get } from "lodash";
|
||||
import React, { useContext } from "react";
|
||||
import * as Yup from "yup";
|
||||
import Input from "../components/shared/Input";
|
||||
import ModalEvents from "../constants/ModalEvents";
|
||||
import DatabaseContext from "../contexts/DatabaseContext";
|
||||
import ModalContext from "../contexts/ModalContext";
|
||||
import DataModal from "./DataModal";
|
||||
|
||||
const initialValues = {
|
||||
@ -18,12 +18,12 @@ const validationSchema = Yup.object().shape({
|
||||
});
|
||||
|
||||
const ResumeModal = () => {
|
||||
const { events } = useContext(ModalContext);
|
||||
const { createResume, updateResume } = useContext(DatabaseContext);
|
||||
|
||||
const getFieldProps = (formik, name) => ({
|
||||
touched: get(formik, `touched.${name}`, false),
|
||||
error: get(formik, `errors.${name}`, ""),
|
||||
isRequired: get(validationSchema, `fields.${name}._exclusive.required`),
|
||||
...formik.getFieldProps(name),
|
||||
});
|
||||
|
||||
@ -42,7 +42,7 @@ const ResumeModal = () => {
|
||||
}}
|
||||
onEdit={updateResume}
|
||||
onCreate={createResume}
|
||||
event={events.CREATE_RESUME_MODAL}
|
||||
event={ModalEvents.CREATE_RESUME_MODAL}
|
||||
>
|
||||
<Input
|
||||
label="Name"
|
||||
|
||||
76
src/modals/sections/AwardModal.js
Normal file
76
src/modals/sections/AwardModal.js
Normal file
@ -0,0 +1,76 @@
|
||||
import { Formik } from "formik";
|
||||
import { get } from "lodash";
|
||||
import React from "react";
|
||||
import * as Yup from "yup";
|
||||
import Input from "../../components/shared/Input";
|
||||
import ModalEvents from "../../constants/ModalEvents";
|
||||
import DataModal from "../DataModal";
|
||||
|
||||
const initialValues = {
|
||||
title: "",
|
||||
awarder: "",
|
||||
date: "",
|
||||
summary: "",
|
||||
};
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
title: Yup.string().required("This is a required field."),
|
||||
awarder: Yup.string().required("This is a required field."),
|
||||
date: Yup.date().max(new Date()),
|
||||
summary: Yup.string(),
|
||||
});
|
||||
|
||||
const AwardModal = () => {
|
||||
const getFieldProps = (formik, name) => ({
|
||||
touched: get(formik, `touched.${name}`, false),
|
||||
error: get(formik, `errors.${name}`, ""),
|
||||
isRequired: get(validationSchema, `fields.${name}._exclusive.required`),
|
||||
...formik.getFieldProps(name),
|
||||
});
|
||||
|
||||
return (
|
||||
<Formik
|
||||
validateOnBlur
|
||||
initialValues={initialValues}
|
||||
validationSchema={validationSchema}
|
||||
>
|
||||
{(formik) => (
|
||||
<DataModal
|
||||
path="awards.items"
|
||||
name="Awards"
|
||||
event={ModalEvents.AWARD_MODAL}
|
||||
>
|
||||
<div className="grid grid-cols-2 gap-8">
|
||||
<Input
|
||||
label="Title"
|
||||
className="col-span-2"
|
||||
placeholder="Intl. Flutter Hackathon '19"
|
||||
{...getFieldProps(formik, "title")}
|
||||
/>
|
||||
|
||||
<Input
|
||||
label="Awarder"
|
||||
placeholder="Google"
|
||||
{...getFieldProps(formik, "awarder")}
|
||||
/>
|
||||
|
||||
<Input
|
||||
type="date"
|
||||
label="Date"
|
||||
{...getFieldProps(formik, "date")}
|
||||
/>
|
||||
|
||||
<Input
|
||||
type="textarea"
|
||||
label="Summary"
|
||||
className="col-span-2"
|
||||
{...getFieldProps(formik, "summary")}
|
||||
/>
|
||||
</div>
|
||||
</DataModal>
|
||||
)}
|
||||
</Formik>
|
||||
);
|
||||
};
|
||||
|
||||
export default AwardModal;
|
||||
@ -1,10 +1,10 @@
|
||||
import { Field, FieldArray, Formik } from "formik";
|
||||
import { get } from "lodash";
|
||||
import React, { useContext } from "react";
|
||||
import React from "react";
|
||||
import { MdAdd } from "react-icons/md";
|
||||
import * as Yup from "yup";
|
||||
import Input from "../../components/shared/Input";
|
||||
import ModalContext from "../../contexts/ModalContext";
|
||||
import ModalEvents from "../../constants/ModalEvents";
|
||||
import { handleKeyDown } from "../../utils";
|
||||
import DataModal from "../DataModal";
|
||||
|
||||
@ -36,11 +36,10 @@ const validationSchema = Yup.object().shape({
|
||||
});
|
||||
|
||||
const EducationModal = () => {
|
||||
const { events } = useContext(ModalContext);
|
||||
|
||||
const getFieldProps = (formik, name) => ({
|
||||
touched: get(formik, `touched.${name}`, false),
|
||||
error: get(formik, `errors.${name}`, ""),
|
||||
isRequired: get(validationSchema, `fields.${name}._exclusive.required`),
|
||||
...formik.getFieldProps(name),
|
||||
});
|
||||
|
||||
@ -54,7 +53,7 @@ const EducationModal = () => {
|
||||
<DataModal
|
||||
path="education.items"
|
||||
name="Education"
|
||||
event={events.EDUCATION_MODAL}
|
||||
event={ModalEvents.EDUCATION_MODAL}
|
||||
>
|
||||
<div className="grid grid-cols-2 gap-8">
|
||||
<Input
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { Formik } from "formik";
|
||||
import { get } from "lodash";
|
||||
import React, { useContext } from "react";
|
||||
import React from "react";
|
||||
import * as Yup from "yup";
|
||||
import Input from "../../components/shared/Input";
|
||||
import ModalContext from "../../contexts/ModalContext";
|
||||
import ModalEvents from "../../constants/ModalEvents";
|
||||
import DataModal from "../DataModal";
|
||||
|
||||
const initialValues = {
|
||||
@ -24,11 +24,10 @@ const validationSchema = Yup.object().shape({
|
||||
});
|
||||
|
||||
const SocialModal = () => {
|
||||
const { events } = useContext(ModalContext);
|
||||
|
||||
const getFieldProps = (formik, name) => ({
|
||||
touched: get(formik, `touched.${name}`, false),
|
||||
error: get(formik, `errors.${name}`, ""),
|
||||
isRequired: get(validationSchema, `fields.${name}._exclusive.required`),
|
||||
...formik.getFieldProps(name),
|
||||
});
|
||||
|
||||
@ -42,7 +41,7 @@ const SocialModal = () => {
|
||||
<DataModal
|
||||
path="social.items"
|
||||
name="Social Network"
|
||||
event={events.SOCIAL_MODAL}
|
||||
event={ModalEvents.SOCIAL_MODAL}
|
||||
>
|
||||
<div className="grid grid-cols-2 gap-8">
|
||||
<Input
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import { Field, FieldArray, Formik } from "formik";
|
||||
import { get } from "lodash";
|
||||
import React, { useContext } from "react";
|
||||
import React from "react";
|
||||
import { MdAdd } from "react-icons/md";
|
||||
import * as Yup from "yup";
|
||||
import Input from "../../components/shared/Input";
|
||||
import ModalContext from "../../contexts/ModalContext";
|
||||
import ModalEvents from "../../constants/ModalEvents";
|
||||
import { handleKeyDown } from "../../utils";
|
||||
import DataModal from "../DataModal";
|
||||
|
||||
@ -38,11 +38,10 @@ const validationSchema = Yup.object().shape({
|
||||
});
|
||||
|
||||
const WorkModal = () => {
|
||||
const { events } = useContext(ModalContext);
|
||||
|
||||
const getFieldProps = (formik, name) => ({
|
||||
touched: get(formik, `touched.${name}`, false),
|
||||
error: get(formik, `errors.${name}`, ""),
|
||||
isRequired: get(validationSchema, `fields.${name}._exclusive.required`),
|
||||
...formik.getFieldProps(name),
|
||||
});
|
||||
|
||||
@ -56,7 +55,7 @@ const WorkModal = () => {
|
||||
<DataModal
|
||||
path="work.items"
|
||||
name="Work Experience"
|
||||
event={events.WORK_MODAL}
|
||||
event={ModalEvents.WORK_MODAL}
|
||||
>
|
||||
<div className="grid grid-cols-2 gap-8">
|
||||
<Input
|
||||
|
||||
Reference in New Issue
Block a user