UNPKG

1.64 kBJavaScriptView Raw
1import logo from "./distill-logo.svg";
2
3const html = `
4<style>
5dt-header {
6 display: block;
7 position: relative;
8 height: 60px;
9 background-color: hsl(223, 9%, 25%);
10 width: 100%;
11 box-sizing: border-box;
12 z-index: 2;
13 color: rgba(0, 0, 0, 0.8);
14 border-bottom: 1px solid rgba(0, 0, 0, 0.08);
15 box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
16}
17dt-header .content {
18 height: 70px;
19}
20dt-header a {
21 font-size: 16px;
22 height: 60px;
23 line-height: 60px;
24 text-decoration: none;
25 color: rgba(255, 255, 255, 0.8);
26 padding: 22px 0;
27}
28dt-header a:hover {
29 color: rgba(255, 255, 255, 1);
30}
31dt-header svg {
32 width: 24px;
33 position: relative;
34 top: 4px;
35 margin-right: 2px;
36}
37
38@media(min-width: 1080px) {
39 dt-header {
40 height: 70px;
41 }
42 dt-header a {
43 height: 70px;
44 line-height: 70px;
45 padding: 28px 0;
46 }
47 dt-header .logo {
48 }
49}
50
51dt-header svg path {
52 fill: none;
53 stroke: rgba(255, 255, 255, 0.8);
54 stroke-width: 3px;
55}
56dt-header .logo {
57 font-size: 13px;
58 font-weight: 300;
59 text-transform: uppercase;
60}
61dt-header .nav {
62 float: right;
63 font-weight: 300;
64}
65dt-header .nav a {
66 font-size: 14px;
67}
68</style>
69
70<div class="content l-page">
71 <a href="/" class="logo">
72 ${logo}
73 Distill
74 </a>
75 <div class="nav">
76 <a href="/faq">About</a>
77 <!-- https://twitter.com/distillpub -->
78 </div>
79</div>
80`
81
82export default function(dom, data) {
83 let el = dom.querySelector("dt-header");
84 if(el) {
85 el.innerHTML = html;
86 } else {
87 let header = dom.createElement("dt-header");
88 header.innerHTML = html;
89 let b = dom.querySelector("body");
90 b.insertBefore(header, b.firstChild);
91 }
92}