1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-23 01:29:41 +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", "build": "gatsby build",
"format": "prettier --write 'src/**/*.{js,jsx}'", "format": "prettier --write 'src/**/*.{js,jsx}'",
"format:css": "prettier-stylelint --write --quiet 'src/**/*.{css,scss}'", "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", "test:watch": "npm run lint && jest --coverage --watch",
"deploy": "./scripts/deploy.sh", "deploy": "./scripts/deploy.sh",
"new": "babel-node ./scripts/new.js", "new": "babel-node ./scripts/new.js",

View File

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