UNPKG

1.71 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(200, 60%, 15%);
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@media(min-width: 1080px) {
38 dt-header {
39 height: 70px;
40 }
41 dt-header a {
42 height: 70px;
43 line-height: 70px;
44 padding: 28px 0;
45 }
46 dt-header .logo {
47 }
48}
49dt-header svg path {
50 fill: none;
51 stroke: rgba(255, 255, 255, 0.8);
52 stroke-width: 3px;
53}
54dt-header .logo {
55 font-size: 17px;
56 font-weight: 200;
57}
58dt-header .nav {
59 float: right;
60 font-weight: 300;
61}
62dt-header .nav a {
63 font-size: 12px;
64 margin-left: 24px;
65 text-transform: uppercase;
66}
67</style>
68
69<div class="content l-page">
70 <a href="/" class="logo">
71 ${logo}
72 Distill
73 </a>
74 <div class="nav">
75 <a href="/faq">About</a>
76 <a href="https://github.com/distillpub">GitHub</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}