-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathHero.js
More file actions
138 lines (124 loc) · 3.37 KB
/
Copy pathHero.js
File metadata and controls
138 lines (124 loc) · 3.37 KB
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
import React, { Fragment } from 'react'
import { withPrefix, Link } from 'gatsby'
import siteConfig from '../../data/siteConfig'
import styled from 'styled-components'
const HeroContainer = styled.div`
position: relative;
display: table;
width: 100%;
height: 340px;
overflow: hidden;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
`
const TitleContainer = styled.div`
display: table-cell;
vertical-align: middle;
text-align: center;
width: 100%;
`
const LocationContainer = styled.div`
display: table-footer-group;
vertical-align: center;
text-align: right;
width: 100%;
`
const HeroTitle = styled.h1`
font-size: 3.5rem;
margin: 10px 60px;
color: #fff;
text-shadow: 2px 2px #222222;
font-weight: 800;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
`
const HeroSubtitle = styled.h2`
font-size: 1.7rem;
margin: 10px 60px;
color: #fff;
text-shadow: 2px 2px #222222;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
`
const DateAndAuthor = styled.span`
font-weight: 500;
font-size: 1.2rem;
color: #fff;
text-shadow: 2px 2px #222222;
`
const AuthorLink = styled(Link)`
margin-left: 0.3rem;
font-weight: 500;
font-size: 1.2rem;
color: #fff;
text-shadow: 2px 2px #222222;
&:hover {
border-bottom: 1px dotted #787676;
}
&:before {
content: '@';
}
`
const LocationLink = styled.a`
margin-right: 0.7rem;
font-size: 0.9rem;
color: #fff;
text-shadow: 2px 2px #222222;
font-size: 1rem;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-style: italic;
&:hover {
border-bottom: 1px dotted #787676;
}
`
const LocationMarker = styled.span`
margin-right: 0.4rem;
font-size: 0.75rem;
color: #fff;
text-shadow: 2px 2px #222222;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
`
class Hero extends React.Component {
render() {
const heroImg = this.props.heroImg || withPrefix(siteConfig.siteCover)
const { title } = this.props
const { subtitle } = this.props
const { date } = this.props
const { authors } = this.props
const { coverDescription } = this.props
const { coverLink } = this.props
return (
<HeroContainer style={{ backgroundImage: `url("${heroImg}")` }}>
<TitleContainer>
<HeroTitle>{title}</HeroTitle>
<HeroSubtitle>{subtitle}</HeroSubtitle>
{authors && authors.length != 0 && (
<DateAndAuthor>
by:{' '}
{authors &&
authors.map((author, i) => {
return (
<Fragment key={`author-list-${i}`}>
<AuthorLink to={`authors/${author}`}>{author}</AuthorLink>
{i < authors.length - 1 ? ' ' : ''}
</Fragment>
)
})}
on {date}
</DateAndAuthor>
)}
</TitleContainer>
{coverDescription && coverLink && (
<LocationContainer>
<LocationMarker>
<span className="fa fa-map-marker-alt" />
</LocationMarker>
<LocationLink href={coverLink} target="_blank">
{coverDescription}
</LocationLink>
</LocationContainer>
)}
</HeroContainer>
)
}
}
export default Hero