/
WorkExperience.jsx
152 lines (143 loc) · 4.35 KB
/
WorkExperience.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import React from 'react';
import cx from 'classnames';
import { IconButton, InputGroup, InputGroupV2, Input } from 'light-ui';
import DateSlider from 'COMPONENTS/DateSlider';
import WorkProject from './WorkProject';
import styles from '../../../styles/resume.css';
import locales from 'LOCALES';
const resumeTexts = locales('resume.sections.workExperiences');
class WorkExperience extends React.Component {
constructor(props) {
super(props);
this.state = {
startOpen: false,
endOpen: false
};
this.handleStartFocus = this.handleStartFocus.bind(this);
this.handleEndFocus = this.handleEndFocus.bind(this);
this.handleEndTimeChange = this.handleEndTimeChange.bind(this);
}
handleStartFocus({ focused: startOpen }) {
this.setState({ startOpen });
}
handleEndFocus({ focused: endOpen }) {
this.setState({ endOpen });
}
handleEndTimeChange(endTime, untilNow = false) {
const { handleExperienceChange } = this.props;
handleExperienceChange('endTime')(endTime);
handleExperienceChange('untilNow')(untilNow);
}
renderWorkProjects(projects) {
const { handleProjectChange, deleteProject, disabled } = this.props;
return projects.map((project, index) => (
<WorkProject
key={index}
project={project}
disabled={disabled}
onDelete={deleteProject(index)}
onChange={handleProjectChange(index)}
/>
));
}
render() {
const {
disabled,
addProject,
workExperience,
deleteExperience,
handleExperienceChange,
} = this.props;
const {
url,
endTime,
projects,
untilNow,
company,
position,
startTime,
} = workExperience;
return (
<div className={styles.resume_piece_container}>
<div className={styles.section_second_title}>
{resumeTexts.companyInfo}
</div>
<div className={styles.resume_wrapper}>
<InputGroup
theme="flat"
value={company}
disabled={disabled}
inputClassName={cx(styles.inputGroup, styles.resumeFormItem)}
wrapperClassName={styles.inputTipsoWrapper}
placeholder={resumeTexts.companyName}
onChange={handleExperienceChange('company')}
>
<InputGroupV2
sections={[
{
value: 'http://',
disabled: true,
style: {
width: 50,
padding: '0 5px'
}
},
{
disabled,
type: 'url',
value: url.replace(/^https?:\/\//, ''),
placeholder: resumeTexts.homepage,
onChange: handleExperienceChange('url'),
}
]}
style={{
margin: 0
}}
theme="underline"
className={styles.resumeFormItem}
/>
</InputGroup>
<Input
theme="flat"
value={position}
disabled={disabled}
placeholder={resumeTexts.position}
className={cx(styles.last_input, styles.resumeFormItem)}
onChange={handleExperienceChange('position')}
/>
<IconButton
color="red"
icon="trash-o"
className={styles.resume_delete}
onClick={deleteExperience}
/>
</div>
<div className={styles.resume_wrapper}>
<DateSlider
initialStart={startTime}
initialEnd={untilNow ? null : endTime}
startText={resumeTexts.entriedAt}
endText={resumeTexts.dimissionAt}
onStartChange={handleExperienceChange('startTime')}
onEndChange={this.handleEndTimeChange}
/>
</div>
<div className={styles.project_wrapper}>
<div className={styles.section_second_title}>
{resumeTexts.joinedProjects}
</div>
{this.renderWorkProjects(projects)}
<div
className={styles.resume_add}
onClick={addProject}
>
<i className="fa fa-plus-circle" aria-hidden="true" />
{resumeTexts.sideButton}
</div>
</div>
</div>
);
}
}
export default WorkExperience;