summaryrefslogtreecommitdiff
path: root/examples/snowpack/src/components/Hero.astro
blob: e0feb35f8fe9166e2f83c961d0b1de631917f038 (plain) (blame)
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
---
import Button from './Button.astro';
---

<style lang="scss">
  @use '../../public/styles/var' as *;
  @use '../../public/styles/animations' as *;

  .hero {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50vh;
    max-height: 24rem;
    color: #111;
    line-height: 1.5;
    background: #2a85ca40;
    background-image: url("data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 512' title='mountain' class='logo' fill='%23FFFB'%3E%3Cpath d='M634.92 462.7l-288-448C341.03 5.54 330.89 0 320 0s-21.03 5.54-26.92 14.7l-288 448a32.001 32.001 0 0 0-1.17 32.64A32.004 32.004 0 0 0 32 512h576c11.71 0 22.48-6.39 28.09-16.67a31.983 31.983 0 0 0-1.17-32.63zM320 91.18L405.39 224H320l-64 64-38.06-38.06L320 91.18z' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: calc(100% + 100px) calc(100% + 64px);
    background-size: 50%;
    border-bottom: 1px solid #0003;
    //margin-top: $nav-height;

    @media (min-width: $breakpoint-l) {
      margin: 0;
      min-height: 24rem;
      max-height: 30rem;
    }

    a {
      color: white;
    }

    > svg {
      display: block;
      margin: auto;
      opacity: 0.9;
    }

    .logo {
      position: absolute;
      right: 0;
      width: 100%;
    }
    .logo path {
      fill: #fff;
    }

    .section {
      padding: 1rem * 2;
    }
  }

  .hero-cta {
    display: flex;
    justify-content: center;
    margin: 1.5rem auto 0;
  }

  .header-link {
    padding-left: 2px;
  }

  .header-logo {
    display: flex;
    align-items: center;
    float: left;
    margin: 0 -20px 0 0;
    font-weight: bold;
    font-size: 36px;
    line-height: 1;

    @media (min-width: $breakpoint-m) {
      margin: 0 20px 0 0;
    }

    svg {
      width: 31px;
      height: 31px;
      margin-right: 8px;
      margin-left: 2px;
      padding: 0;
      color: #fff;
    }
  }

  .header-snowpack {
    margin: 0 auto 0.75rem;
    font-weight: 900;
    font-size: 3.5rem;
    font-weight: 900;
    font-family: $heading;
    line-height: 1;
    letter-spacing: -0.07em;
    text-align: center;
    opacity: 0.9;

    @media (min-width: $breakpoint-m) {
      max-width: none;
      font-size: 5.75rem;
      opacity: 1;
    }
  }

  .header-snowpack-subtitle {
    margin: 0;
    margin: auto;
    font-weight: 500;
    font-family: $heading;
    font-size: 2rem;
    line-height: 1;
    letter-spacing: -0.05em;
    text-align: center;

    @media (min-width: $breakpoint-m) {
      font-size: 3rem;
    }
  }

  .copy-button {
    display: none;
    flex: none;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 292px;
    padding: 0.5em 1em;
    font-size: 100%;
    font-family: "Menlo", "ui-monospace", "SFMono-Regular", "Monaco", "Consolas", "Liberation Mono", "Courier New", monospace;
    line-height: 1.5rem;
    background-color: white;
    border: 1px solid #0006;
    border-radius: 4px;
    cursor: pointer;
    @include animation-copy-button;

    @media (min-width: $breakpoint-m) {
      display: flex;
    }

    svg,
    .faded {
      color: #ccc;
      transition: color 0.1s ease-out;
    }
  }
</style>

<div class="hero">
  <div class="section">
    <h1 class="header-snowpack">Snowpack</h1>
    <p class="header-snowpack-subtitle">The faster frontend build tool.</p>

    <div class="hero-cta">
      <a href="/tutorials/quick-start"><Button style="primary">Get started</Button></a>
      <div style="margin: 0.5rem"></div>
      <button id="copy-button" class="copy-button hidden-mobile" data-clipboard-text="npm install snowpack">
        <span class="faded" style="margin-right: 0.75rem;">$</span>
        <span id="copy-button-text">npm install snowpack</span>
        <svg style="height: 22px;width: 22px;margin: -0.1rem -0.1rem 0 0.75rem;" aria-hidden="true" focusable="false"
          data-prefix="far" data-icon="clone" class="svg-inline--fa fa-clone fa-w-16" role="img"
          xmlns="http://www.w3.org/2000/svg" viewbox="0 0 512 512">
          <path fill="currentColor"
            d="M464 0H144c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h320c26.51 0 48-21.49 48-48v-48h48c26.51 0 48-21.49 48-48V48c0-26.51-21.49-48-48-48zM362 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h42v224c0 26.51 21.49 48 48 48h224v42a6 6 0 0 1-6 6zm96-96H150a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h308a6 6 0 0 1 6 6v308a6 6 0 0 1-6 6z">
          </path>
        </svg>
      </button>
      <script type="module">
        import Clipboard from 'https://cdn.skypack.dev/pin/clipboard@v2.0.6-eJjsV6JYCJOnOsq3YfEc/min/clipboard.js';
        const clippy = new Clipboard('.copy-button');
        const copyText = document.getElementById('copy-button').innerHTML;
        clippy.on('success', function (e) {
          document.getElementById('copy-button').style.minWidth = document.getElementById('copy-button').offsetWidth;
          console.info('Trigger:', e);
          document.getElementById('copy-button').innerHTML = '<span>copied to clipboard!</span>';
          document.getElementById('copy-button').addEventListener("mouseleave", function (event) {
            document.getElementById('copy-button').innerHTML = copyText;
          }, false);

          setTimeout(() => {
            e
              .trigger
              .classList
              .remove('active')
          }, 1000);
          e.clearSelection();
        });
      </script>
    </div>
    <div class="hero-cta">
      <!-- Place this tag where you want the button to render. -->
      <div class="hidden-mobile" style="text-align: center; height: 36px;">
        <a class="github-button" href="https://github.com/snowpackjs/snowpack" data-icon="octicon-star"
          data-size="large" data-show-count="true" aria-label="Star snowpackjs/snowpack on GitHub">Star</a>
      </div>
    </div>
  </div>
</div>