mirror of https://github.com/mitchell/mjfs.us.git
Refactor how data from files are handled
This commit is contained in:
parent
e9ffbad7ca
commit
1aebe5ebcf
|
@ -1,7 +1,7 @@
|
|||
import React, { PureComponent, ReactNode } from "react"
|
||||
|
||||
import Job from "../../components/Job"
|
||||
import jobsData from "../../data/jobs.json"
|
||||
import jobs from "../../data/jobs.json"
|
||||
import "./index.css"
|
||||
|
||||
type JobData = {
|
||||
|
@ -13,12 +13,10 @@ type JobData = {
|
|||
|
||||
export default class Experience extends PureComponent {
|
||||
public render(): ReactNode {
|
||||
return (
|
||||
<div className="experience-container">{this.renderJobs(jobsData)}</div>
|
||||
)
|
||||
return <div className="experience-container">{this.renderJobs()}</div>
|
||||
}
|
||||
|
||||
private renderJobs(jobs: JobData[]): ReactNode[] {
|
||||
private renderJobs(): ReactNode[] {
|
||||
return jobs.map((job: JobData) => (
|
||||
<Job
|
||||
key={job.title}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import React, { PureComponent, ReactNode } from "react"
|
||||
|
||||
import Project from "../../components/Project"
|
||||
|
||||
import projects from "../../data/projects.json"
|
||||
import "./index.css"
|
||||
|
||||
import projectsData from "../../data/projects.json"
|
||||
|
||||
type BadgeData = {
|
||||
imgUrl: string
|
||||
linkUrl: string
|
||||
|
@ -21,14 +19,10 @@ type ProjectData = {
|
|||
|
||||
export default class Projects extends PureComponent {
|
||||
public render(): ReactNode {
|
||||
return (
|
||||
<div className="projects-container">
|
||||
{this.renderProjects(projectsData)}
|
||||
</div>
|
||||
)
|
||||
return <div className="projects-container">{this.renderProjects()}</div>
|
||||
}
|
||||
|
||||
private renderProjects(projects: ProjectData[]): ReactNode[] {
|
||||
private renderProjects(): ReactNode[] {
|
||||
return projects.map((project: ProjectData) => (
|
||||
<Project
|
||||
key={project.title}
|
||||
|
|
Loading…
Reference in New Issue