-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathPageHeading.js
76 lines (69 loc) · 1.47 KB
/
PageHeading.js
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
import React from "react";
import styled from "react-emotion";
import theme from "../styles/theme";
const Container = styled.div`
position: relative;
height: calc(22vh + 6vw);
min-height: 260px;
background: linear-gradient(
0deg,
rgba(0, 0, 0, 0.7) 0%,
rgba(0, 0, 0, 0) 100%
);
`;
const Image = styled.div`
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -1;
background-color: ${theme.color.brandDark};
background-size: cover;
background-position: 50% 50%;
//filter: brightness(0.4);
`;
const Heading = styled.h1`
height: inherit;
min-height: inherit;
margin: 0;
padding: ${theme.space.m};
display: flex;
align-items: center;
justify-content: center;
text-align: center;
color: ${theme.color.background};
line-height: 1.2;
font-size: calc(1rem + 1vh + 2vw);
`;
const Extra = styled.small`
position: absolute;
right: ${theme.space.s};
bottom: ${theme.space.s};
line-height: 1;
font-size: ${theme.fontSize.zeta};
font-family: ${theme.font.small};
opacity: 0.6;
& a {
color: ${theme.color.background};
}
`;
const PageHeading = ({ image, extra, children }) => (
<Container>
{image && (
<Image
style={{
backgroundImage: `url(${image})`,
}}
/>
)}
<Heading>{children}</Heading>
{extra && (
<Extra
aria-hidden="true"
dangerouslySetInnerHTML={{ __html: extra }}
/>
)}
</Container>
);
export default PageHeading;