|
1
|
|
|
import React, { FunctionComponent } from "react"; |
|
2
|
|
|
import { useIntl } from "react-intl"; |
|
3
|
|
|
import detailsMessages from "./detailsMessages"; |
|
4
|
|
|
import { getLocale } from "../../../helpers/localize"; |
|
5
|
|
|
import { readableDateFromString } from "../../../helpers/dates"; |
|
6
|
|
|
import { ExperiencePersonal } from "../../../models/types"; |
|
7
|
|
|
|
|
8
|
|
|
const ExperiencePersonalDetails: FunctionComponent<{ |
|
9
|
|
|
experience: ExperiencePersonal; |
|
10
|
|
|
}> = ({ experience }) => { |
|
11
|
|
|
const intl = useIntl(); |
|
12
|
|
|
const locale = getLocale(intl.locale); |
|
13
|
|
|
const { title, description } = experience; |
|
14
|
|
|
const isShareable = experience.is_shareable; |
|
15
|
|
|
const startDate = experience.start_date; |
|
16
|
|
|
const endDate = experience.end_date; |
|
17
|
|
|
const isActive = experience.is_active; |
|
18
|
|
|
|
|
19
|
|
|
const notApplicable = ( |
|
20
|
|
|
<p data-h2-font-color="b(gray-1)"> |
|
21
|
|
|
{intl.formatMessage(detailsMessages.notApplicable)} |
|
22
|
|
|
</p> |
|
23
|
|
|
); |
|
24
|
|
|
const endDateOrNa = endDate ? ( |
|
25
|
|
|
<p>{readableDateFromString(locale, endDate)}</p> |
|
26
|
|
|
) : ( |
|
27
|
|
|
notApplicable |
|
28
|
|
|
); |
|
29
|
|
|
return ( |
|
30
|
|
|
<div data-h2-grid="b(middle, expanded, flush, 1)"> |
|
31
|
|
|
<div data-h2-grid-item="b(1of2) m(1of3)"> |
|
32
|
|
|
<div data-h2-grid-content> |
|
33
|
|
|
<p data-h2-font-weight="b(600)"> |
|
34
|
|
|
{intl.formatMessage(detailsMessages.experienceTypeLabel)} |
|
35
|
|
|
</p> |
|
36
|
|
|
<p> |
|
37
|
|
|
<i |
|
38
|
|
|
className="fas fa-mountain" |
|
39
|
|
|
data-h2-font-color="b(theme-1)" |
|
40
|
|
|
data-h2-margin="b(right, .25)" |
|
41
|
|
|
/> |
|
42
|
|
|
{intl.formatMessage(detailsMessages.personalType)} |
|
43
|
|
|
</p> |
|
44
|
|
|
</div> |
|
45
|
|
|
</div> |
|
46
|
|
|
<div data-h2-grid-item="b(1of2) m(1of3)"> |
|
47
|
|
|
<div data-h2-grid-content> |
|
48
|
|
|
<p data-h2-font-weight="b(600)"> |
|
49
|
|
|
{intl.formatMessage(detailsMessages.personalTitleLabel)} |
|
50
|
|
|
</p> |
|
51
|
|
|
{title ? <p>{title}</p> : notApplicable} |
|
52
|
|
|
</div> |
|
53
|
|
|
</div> |
|
54
|
|
|
<div data-h2-grid-item="b(1of1)"> |
|
55
|
|
|
<div data-h2-grid-content> |
|
56
|
|
|
<p data-h2-font-weight="b(600)"> |
|
57
|
|
|
{intl.formatMessage(detailsMessages.personalDescriptionLabel)} |
|
58
|
|
|
</p> |
|
59
|
|
|
{description ? <p>{description}</p> : notApplicable} |
|
60
|
|
|
</div> |
|
61
|
|
|
</div> |
|
62
|
|
|
<div data-h2-grid-item="b(1of2) m(1of3)"> |
|
63
|
|
|
<div data-h2-grid-content> |
|
64
|
|
|
<p data-h2-font-weight="b(600)"> |
|
65
|
|
|
{intl.formatMessage(detailsMessages.personalShareLabel)} |
|
66
|
|
|
</p> |
|
67
|
|
|
{isShareable ? ( |
|
68
|
|
|
<p> |
|
69
|
|
|
<i |
|
70
|
|
|
className="fas fa-check-circle" |
|
71
|
|
|
data-h2-font-color="b(go)" |
|
72
|
|
|
data-h2-margin="b(right, .25)" |
|
73
|
|
|
/> |
|
74
|
|
|
{intl.formatMessage(detailsMessages.personalShareAllowed)} |
|
75
|
|
|
</p> |
|
76
|
|
|
) : ( |
|
77
|
|
|
<p> |
|
78
|
|
|
<i |
|
79
|
|
|
className="fas fa-check-circle" |
|
80
|
|
|
data-h2-font-color="b(stop)" |
|
81
|
|
|
data-h2-margin="b(right, .25)" |
|
82
|
|
|
/> |
|
83
|
|
|
{intl.formatMessage(detailsMessages.personalShareDenied)} |
|
84
|
|
|
</p> |
|
85
|
|
|
)} |
|
86
|
|
|
</div> |
|
87
|
|
|
</div> |
|
88
|
|
|
<div data-h2-grid-item="b(1of2) m(1of3)"> |
|
89
|
|
|
<div data-h2-grid-content> |
|
90
|
|
|
<p data-h2-font-weight="b(600)"> |
|
91
|
|
|
{intl.formatMessage(detailsMessages.startDateLabel)} |
|
92
|
|
|
</p> |
|
93
|
|
|
{startDate ? ( |
|
94
|
|
|
<p>{readableDateFromString(locale, startDate)}</p> |
|
95
|
|
|
) : ( |
|
96
|
|
|
notApplicable |
|
97
|
|
|
)} |
|
98
|
|
|
</div> |
|
99
|
|
|
</div> |
|
100
|
|
|
<div data-h2-grid-item="b(1of2) m(1of3)"> |
|
101
|
|
|
<div data-h2-grid-content> |
|
102
|
|
|
<p data-h2-font-weight="b(600)"> |
|
103
|
|
|
{intl.formatMessage(detailsMessages.endDateLabel)} |
|
104
|
|
|
</p> |
|
105
|
|
|
{isActive ? ( |
|
106
|
|
|
<p>{intl.formatMessage(detailsMessages.ongoing)}</p> |
|
107
|
|
|
) : ( |
|
108
|
|
|
endDateOrNa |
|
109
|
|
|
)} |
|
110
|
|
|
</div> |
|
111
|
|
|
</div> |
|
112
|
|
|
</div> |
|
113
|
|
|
); |
|
114
|
|
|
}; |
|
115
|
|
|
|
|
116
|
|
|
export default ExperiencePersonalDetails; |
|
117
|
|
|
|