1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-11-13 16:45:12 +01:00

data fixes

This commit is contained in:
Matthias Kretschmann 2019-11-19 23:10:50 +01:00
parent 85bfc44d66
commit 7e391bffa0
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 22 additions and 5 deletions

View File

@ -16,7 +16,7 @@
"build": "gatsby build",
"format": "prettier --write 'src/**/*.{js,jsx}'",
"format:css": "prettier-stylelint --write --quiet 'src/**/*.{css,scss}'",
"test": "npm run lint && jest --coverage",
"test": "npm run lint && jest --coverage --silent",
"test:watch": "npm run lint && jest --coverage --watch",
"deploy": "./scripts/deploy.sh",
"new": "babel-node ./scripts/new.js",

View File

@ -7,7 +7,7 @@ import html from 'remark-html'
import breaks from 'remark-breaks'
import styles from './ResumeItem.module.scss'
export const markdownOutput = text =>
const markdownOutput = text =>
remark()
.use(parse, { gfm: true, commonmark: true, pedantic: true })
.use(html)
@ -15,17 +15,23 @@ export const markdownOutput = text =>
.use(remark2react)
.processSync(text).contents
export default function ResumeItem({ workPlace, eduPlace, award }) {
function normalizeData(workPlace, eduPlace, award) {
const title = workPlace
? workPlace.company
: award
? award.title
: eduPlace.institution
: eduPlace
? eduPlace.institution
: null
const subTitle = workPlace
? workPlace.position
: award
? award.awarder
: eduPlace.area
: eduPlace
? eduPlace.area
: null
const text = workPlace
? workPlace.summary
: award && award.summary
@ -33,8 +39,19 @@ export default function ResumeItem({ workPlace, eduPlace, award }) {
: eduPlace
? eduPlace.studyType
: null
const { startDate, endDate, date } = workPlace || eduPlace || award
return { title, subTitle, text, startDate, endDate, date }
}
export default function ResumeItem({ workPlace, eduPlace, award }) {
const { title, subTitle, text, startDate, endDate, date } = normalizeData(
workPlace,
eduPlace,
award
)
const dateStart = date
? new Date(date).getFullYear()
: new Date(startDate).getFullYear()