-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTitle.js
100 lines (83 loc) · 1.91 KB
/
Title.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import { React, html, css } from "./package.js";
import { Toggle } from "./Toggle.js";
/**
* hunt: true if Hunt side should be shown, false if Club side
* setHunt: function for setting, if false show non-interactive
*/
const Title = ({ hunt, setHunt }) => {
const title = css`
${setHunt && "cursor: pointer;"}
display: flex;
height: 2rem;
justify-content: center;
position: relative;
@media (max-width: 600px) {
height: 3.3rem;
}
@media (max-width: 400px) {
height: 5.5rem;
top: 1.5rem;
}
`;
const headerH1 = css`
border: none;
display: block;
font: 1.3rem "Syncopate", sans-serif;
margin: 0;
padding: 0;
position: absolute;
text-transform: uppercase;
text-shadow: 0 1px 1px black;
transition: color 0.2s;
width: calc(50vw - 3rem);
br {
display: none;
}
@media (max-width: 600px) {
width: calc(50vw - 3rem);
br {
display: initial;
}
}
@media (max-width: 400px) {
width: calc(100vw - 2rem);
br {
display: none;
}
}
`;
const header1 = css`
color: ${!setHunt || hunt ? "#e1ba9c" : "#ab8061"};
left: 0;
text-align: right;
top: 0;
@media (max-width: 400px) {
left: initial;
text-align: center;
top: -1.2em;
}
`;
const header2 = css`
color: ${!setHunt || !hunt ? "#e1ba9c" : "#ab8061"};
text-align: left;
top: 0;
right: 0;
@media (max-width: 400px) {
top: 2em;
text-align: center;
right: initial;
}
`;
const toggle = (e) => {
e.stopPropagation();
setHunt(!hunt);
};
return html`
<div class=${title} onclick=${toggle}>
<h1 class="${headerH1} ${header1}">Mystery <br />Hunt</h1>
<${Toggle} hunt=${hunt} toggle=${setHunt && toggle} />
<h1 class="${headerH1} ${header2}">Puzzle <br />Club</h1>
</div>
`;
};
export { Title };