Refactor JobHistory

This commit is contained in:
Dejvino 2023-05-25 15:33:18 +02:00
parent 2308c0394b
commit ecefefb757

View File

@ -5,7 +5,6 @@ import Col from 'react-bootstrap/Col';
import Row from 'react-bootstrap/Row';
import JobCard from './JobCard';
import { usePersonContext } from './PersonContext';
import { Job } from '../../PersonalDataTypes';
import { partition } from '../utils';
const entriesPerRow = 2
@ -13,20 +12,13 @@ const entriesPerRow = 2
export default function JobsHistory() {
const person = usePersonContext()
function JobEntry(job: Job, heading?: string) {
return <JobCard
heading={heading}
{...job}
/>
}
return (
<Container>
<h2>Experience</h2>
{person.jobs.current && (
<Row>
<Col>
{JobEntry(person.jobs.current, 'Current position')}
<JobCard heading={'Current position'} {...person.jobs.current} />
</Col>
</Row>
)}
@ -34,11 +26,11 @@ export default function JobsHistory() {
<Row key={index}>
{(jobs.map((job, subindex) => (
<Col key={index + '_' + subindex}>
{JobEntry(job)}
<JobCard {...job} />
</Col>
)))}
</Row>
))}
))}
</Container>
)
}