1
|
|
|
import React from 'react' |
2
|
|
|
import { HOME } from '~/modules/home/consts/pages' |
3
|
|
|
import styled from 'styled-components/macro' |
4
|
|
|
import { Translate } from 'react-localize-redux' |
5
|
|
|
import Container from 'react-bootstrap/Container' |
6
|
|
|
import Anchor from '~/modules/home/components/common/Anchor' |
7
|
|
|
import Typist from '~/modules/home/components/common/Typist' |
8
|
|
|
import useWindowDimensions from '~/modules/core/utils/useWindowDimensions' |
9
|
|
|
|
10
|
1 |
|
const Home = () => { |
11
|
1 |
|
const { width } = useWindowDimensions() |
12
|
1 |
|
return ( |
13
|
|
|
<HomeSection> |
14
|
|
|
<Anchor id={HOME} /> |
15
|
|
|
<Background /> |
16
|
|
|
<Overlay> |
17
|
|
|
<Container> |
18
|
|
|
<Header> |
19
|
|
|
<TitleName> |
20
|
|
|
<Translate id="Name" /> |
21
|
|
|
</TitleName> |
22
|
|
|
<TitleJob> |
23
|
|
|
<Typist>{getTexts(width)}</Typist> |
24
|
|
|
</TitleJob> |
25
|
|
|
</Header> |
26
|
|
|
</Container> |
27
|
|
|
</Overlay> |
28
|
|
|
</HomeSection> |
29
|
|
|
) |
30
|
|
|
} |
31
|
|
|
|
32
|
1 |
|
export const getTexts = width => { |
33
|
3 |
|
const typingTexts = ['Job'] |
34
|
|
|
|
35
|
3 |
|
const secondText = width < 460 ? 'Welcome-short' : 'Welcome' |
36
|
3 |
|
typingTexts.push(secondText) |
37
|
|
|
|
38
|
6 |
|
return typingTexts.map(item => <Translate key={item} id={item} />) |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
const HomeSection = styled.section` |
42
|
|
|
position: relative; |
43
|
|
|
width: 100%; |
44
|
|
|
overflow: hidden; |
45
|
|
|
|
46
|
|
|
&::after { |
47
|
|
|
content: ''; |
48
|
|
|
position: absolute; |
49
|
|
|
left: 0; |
50
|
|
|
bottom: 0; |
51
|
|
|
display: block; |
52
|
|
|
width: 100%; |
53
|
|
|
height: 0; |
54
|
|
|
clear: both; |
55
|
1 |
|
box-shadow: 0 0 2px 1px ${props => props.theme.colors.colorDark}; |
56
|
|
|
} |
57
|
|
|
` |
58
|
|
|
|
59
|
|
|
const TitleName = styled.h1` |
60
|
|
|
margin-bottom: 10px; |
61
|
|
|
font-size: 100px; |
62
|
1 |
|
color: ${props => props.theme.colors.ghostWhite}; |
63
|
1 |
|
text-shadow: 1px 1px 1px ${props => props.theme.colors.colorDark}; |
64
|
|
|
width: fit-content; |
65
|
1 |
|
background: ${props => props.theme.titleBgColor}; |
66
|
|
|
|
67
|
|
|
@media screen and (max-width: 1200px) { |
68
|
|
|
font-size: 75px; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
@media screen and (max-width: 800px) { |
72
|
|
|
font-size: 50px; |
73
|
|
|
} |
74
|
|
|
` |
75
|
|
|
|
76
|
|
|
const TitleJob = styled.h2` |
77
|
|
|
width: fit-content; |
78
|
1 |
|
background: ${props => props.theme.titleBgColor}; |
79
|
1 |
|
color: ${props => props.theme.colors.ghostWhite}; |
80
|
1 |
|
font-family: ${props => props.theme.fonts.fontTrebuchet}; |
81
|
1 |
|
text-shadow: 1px 1px 2px ${props => props.theme.colors.colorDark}; |
82
|
|
|
` |
83
|
|
|
|
84
|
|
|
const Background = styled.div` |
85
|
|
|
position: absolute; |
86
|
|
|
min-width: 100%; |
87
|
|
|
min-height: 100%; |
88
|
|
|
z-index: 0; |
89
|
1 |
|
background: transparent url(${props => props.theme.images.background}) center |
90
|
|
|
0 no-repeat; |
91
|
|
|
background-attachment: fixed; |
92
|
|
|
background-size: cover; |
93
|
|
|
|
94
|
|
|
@media screen and (max-width: 800px) { |
95
|
1 |
|
background: transparent url(${props => props.theme.images.backgroundMobile}) |
96
|
|
|
center 0 no-repeat; |
97
|
|
|
background-size: cover; |
98
|
|
|
background-position: center; |
99
|
|
|
} |
100
|
|
|
` |
101
|
|
|
|
102
|
|
|
const Overlay = styled.div` |
103
|
|
|
position: relative; |
104
|
|
|
width: 100%; |
105
|
|
|
height: 100%; |
106
|
1 |
|
background-color: ${props => props.theme.images.overlayBgColor}; |
107
|
|
|
zoom: 1; |
108
|
1 |
|
background-image: url(${props => props.theme.images.overlay}); |
109
|
|
|
background-repeat: repeat; |
110
|
|
|
background-attachment: fixed; |
111
|
|
|
|
112
|
|
|
@media screen and (max-width: 800px) { |
113
|
1 |
|
background-color: ${props => props.theme.images.overlayBgColorMobile}; |
114
|
|
|
} |
115
|
|
|
` |
116
|
|
|
|
117
|
|
|
const Header = styled.header` |
118
|
1 |
|
padding: ${props => props.theme.headerPadding}; |
119
|
|
|
text-align: left; |
120
|
|
|
|
121
|
|
|
@media screen and (max-width: 800px) { |
122
|
|
|
text-align: center; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
@media screen and (max-width: 600px) { |
126
|
|
|
padding: 100px 0 300px; |
127
|
|
|
} |
128
|
|
|
` |
129
|
|
|
export default Home |
130
|
|
|
|