mirror of
https://github.com/rjNemo/devbook_ts
synced 2026-06-12 13:36:43 +00:00
[refactor] Experience.ts: change employer to company; move TimePeriod to its own file
This commit is contained in:
parent
054e7a80c1
commit
c177d7749d
6 changed files with 25 additions and 20 deletions
|
|
@ -35,7 +35,7 @@ export const dummyDevFull: DevFull = {
|
||||||
'Lorem ipsum, dolor sit amet consectetur adipisicing elit. Blanditiis unde quae vero enim adipisci voluptas magni sapiente reprehenderit error minima.',
|
'Lorem ipsum, dolor sit amet consectetur adipisicing elit. Blanditiis unde quae vero enim adipisci voluptas magni sapiente reprehenderit error minima.',
|
||||||
experiences: [
|
experiences: [
|
||||||
{
|
{
|
||||||
employer: 'Microsoft',
|
company: 'Microsoft',
|
||||||
from: new Date(2011, 10),
|
from: new Date(2011, 10),
|
||||||
to: 'Current',
|
to: 'Current',
|
||||||
position: 'Senior Developer',
|
position: 'Senior Developer',
|
||||||
|
|
@ -43,7 +43,7 @@ export const dummyDevFull: DevFull = {
|
||||||
'Lorem ipsum dolor sit, amet consectetur adipisicing elit. Voluptas corrupti rem eius, accusantium ipsum vel eveniet magnam voluptatum? Minus, voluptatum!',
|
'Lorem ipsum dolor sit, amet consectetur adipisicing elit. Voluptas corrupti rem eius, accusantium ipsum vel eveniet magnam voluptatum? Minus, voluptatum!',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
employer: 'Sun Microsystems',
|
company: 'Sun Microsystems',
|
||||||
from: new Date(2004, 10),
|
from: new Date(2004, 10),
|
||||||
to: new Date(2010, 11),
|
to: new Date(2010, 11),
|
||||||
position: 'System Admin',
|
position: 'System Admin',
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import {TimePeriod} from '../types';
|
import TimePeriod from '../types/TimePeriod';
|
||||||
|
|
||||||
interface Education {
|
interface Education {
|
||||||
school: string;
|
school: string;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {TimePeriod} from '../types';
|
import TimePeriod from '../types/TimePeriod';
|
||||||
|
|
||||||
interface Experience {
|
interface Experience {
|
||||||
employer: string;
|
company: string;
|
||||||
from: Date;
|
from: Date;
|
||||||
to: TimePeriod;
|
to: TimePeriod;
|
||||||
position: string;
|
position: string;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import {
|
||||||
} from '@fortawesome/free-solid-svg-icons';
|
} from '@fortawesome/free-solid-svg-icons';
|
||||||
import DevFull, {dummyDevFull as dev} from '../models/DevFull';
|
import DevFull, {dummyDevFull as dev} from '../models/DevFull';
|
||||||
import Experience from '../models/Experience';
|
import Experience from '../models/Experience';
|
||||||
import {parseDate} from '../types';
|
import {getTimePeriod} from '../types/TimePeriod';
|
||||||
import Education from '../models/Education';
|
import Education from '../models/Education';
|
||||||
import Repo from '../models/Repo';
|
import Repo from '../models/Repo';
|
||||||
|
|
||||||
|
|
@ -83,8 +83,8 @@ const Profile: FC<DevFull> = () => {
|
||||||
<h2 className="text-primary">Experiences</h2>
|
<h2 className="text-primary">Experiences</h2>
|
||||||
{dev.experiences.map((exp: Experience, i: number) => (
|
{dev.experiences.map((exp: Experience, i: number) => (
|
||||||
<div key={i}>
|
<div key={i}>
|
||||||
<h3>{exp.employer}</h3>
|
<h3>{exp.company}</h3>
|
||||||
<p>{`${parseDate(exp.from)} - ${parseDate(exp.to)}`}</p>
|
<p>{getTimePeriod(exp.from, exp.to)}</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>Position: </strong>
|
<strong>Position: </strong>
|
||||||
{exp.position}
|
{exp.position}
|
||||||
|
|
@ -102,7 +102,7 @@ const Profile: FC<DevFull> = () => {
|
||||||
{dev.educations.map((edu: Education, i: number) => (
|
{dev.educations.map((edu: Education, i: number) => (
|
||||||
<div key={i}>
|
<div key={i}>
|
||||||
<h3>{edu.school}</h3>
|
<h3>{edu.school}</h3>
|
||||||
<p>{`${parseDate(edu.from)} - ${parseDate(edu.to)}`}</p>
|
<p>{getTimePeriod(edu.from, edu.to)}</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>Degree: </strong>
|
<strong>Degree: </strong>
|
||||||
{edu.degree}
|
{edu.degree}
|
||||||
|
|
|
||||||
16
src/types/TimePeriod.ts
Normal file
16
src/types/TimePeriod.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
|
type TimePeriod = Date | 'Current';
|
||||||
|
|
||||||
|
/** format exp date to be used */
|
||||||
|
const parseDate = (date: TimePeriod): string => {
|
||||||
|
if (date === 'Current') {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
return moment(date).format('MMM. YYYY');
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getTimePeriod = (from: TimePeriod, to: TimePeriod): string =>
|
||||||
|
`${parseDate(from)} - ${parseDate(to)}`;
|
||||||
|
|
||||||
|
export default TimePeriod;
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
import moment from 'moment';
|
|
||||||
|
|
||||||
export type TimePeriod = Date | 'Current';
|
|
||||||
|
|
||||||
/** format exp date to be used */
|
|
||||||
export const parseDate = (date: TimePeriod): string => {
|
|
||||||
if (date === 'Current') {
|
|
||||||
return date;
|
|
||||||
}
|
|
||||||
return moment(date).format('MMM. YYYY');
|
|
||||||
};
|
|
||||||
Loading…
Reference in a new issue