1
|
|
|
import React, { useState } from 'react' |
2
|
|
|
import styled from 'styled-components/macro' |
3
|
|
|
import PropTypes from 'prop-types' |
4
|
|
|
import Title from '~/modules/home/components/experiences/Title' |
5
|
|
|
import Role from '~/modules/home/components/experiences/Role' |
6
|
|
|
import Description from '~/modules/home/components/experiences/Description' |
7
|
|
|
import Bold from '~/modules/home/components/experiences/Bold' |
8
|
|
|
import { Translate } from 'react-localize-redux' |
9
|
|
|
|
10
|
1 |
|
const Item = ({ title, description, descriptionExtra, skill, role }) => { |
11
|
|
|
const [isShowExtra, setIsShowExtra] = useState(false) |
12
|
|
|
return ( |
13
|
|
|
<Container> |
14
|
|
|
<Title> |
15
|
|
|
<Translate id={title} /> |
16
|
|
|
</Title> |
17
|
|
|
<Role> |
18
|
|
|
<Translate id={role} /> |
19
|
|
|
</Role> |
20
|
|
|
<Description> |
21
|
|
|
<Bold> |
22
|
|
|
<Translate id={skill} /> |
23
|
|
|
</Bold> |
24
|
|
|
</Description> |
25
|
|
|
<Description> |
26
|
|
|
<Translate id={description} /> |
27
|
|
|
<Translate> |
28
|
|
|
{({ translate }) => { |
29
|
|
|
const translation = translate(descriptionExtra) |
30
|
2 |
|
if (!translation.toString().includes('Missing translationId')) { |
31
|
|
|
return ( |
32
|
|
|
<> |
33
|
|
|
<HideOrShowBlock isShowExtra={isShowExtra}> |
34
|
|
|
<Translate id={descriptionExtra} /> |
35
|
|
|
</HideOrShowBlock> |
36
|
|
|
|
37
|
|
|
<ExtraContainer> |
38
|
|
|
<Extra onClick={() => setIsShowExtra(!isShowExtra)}> |
39
|
|
|
{isShowExtra ? null : translate('See more')} |
40
|
|
|
</Extra> |
41
|
|
|
</ExtraContainer> |
42
|
|
|
</> |
43
|
|
|
) |
44
|
|
|
} |
45
|
|
|
return '' |
46
|
|
|
}} |
47
|
|
|
</Translate> |
48
|
|
|
</Description> |
49
|
|
|
</Container> |
50
|
|
|
) |
51
|
|
|
} |
52
|
|
|
|
53
|
1 |
|
Item.propTypes = { |
54
|
|
|
title: PropTypes.string, |
55
|
|
|
description: PropTypes.string, |
56
|
|
|
descriptionExtra: PropTypes.string, |
57
|
|
|
skill: PropTypes.string, |
58
|
|
|
role: PropTypes.string |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
export default Item |
62
|
|
|
|
63
|
|
|
const Container = styled.div`` |
64
|
|
|
|
65
|
|
|
const HideOrShowBlock = styled.span` |
66
|
2 |
|
display: ${props => (props.isShowExtra ? 'block' : 'none')}; |
67
|
|
|
` |
68
|
|
|
|
69
|
|
|
const ExtraContainer = styled.span` |
70
|
|
|
display: flex; |
71
|
|
|
justify-content: flex-end; |
72
|
|
|
` |
73
|
|
|
|
74
|
|
|
const Extra = styled.a` |
75
|
|
|
cursor: pointer; |
76
|
|
|
color: ${props => props.theme.colors.colorDark}; |
77
|
|
|
font-weight: 600 !important; |
78
|
|
|
text-decoration: underline; |
79
|
|
|
|
80
|
|
|
@media screen and (max-width: 1170px) { |
81
|
|
|
font-size: 0.8125rem; |
82
|
|
|
} |
83
|
|
|
` |
84
|
|
|
|