summaryrefslogtreecommitdiff
path: root/src/lib/Header.svelte
blob: 7471a8aadee6c3e1ecc5983f73b3a9a47c53aa75 (plain)
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
<script>
  import MediaQuery from "../lib/MediaQuery.svelte";
  import logo from "../assets/embroidery-viewer-logo.webp";
  import logoMobile from "../assets/embroidery-viewer-logo-mobile.webp";

  const configsFor = (matches) => {
    return matches
      ? { src: logoMobile, width: 350, height: 96 }
      : { src: logo, width: 460, height: 200 };
  };
</script>

<header>
  <a href="/">
    <MediaQuery query="(min-width: 481px) and (max-width: 812px)" let:matches>
      {@const configs = configsFor(matches)}
      <img
        class="logo"
        alt="Embroidery viewer logo."
        src={configs.src}
        width={configs.width}
        height={configs.height}
      />
    </MediaQuery>
  </a>
</header>

<style>
  header {
    margin-top: 100px;
  }
  .logo {
    background-image: logo;
  }

  @media only screen and (max-device-width: 812px) {
    .logo {
      width: 100%;
      padding: 20px;
    }
  }
</style>