aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server/src/routes/__layout.svelte
blob: e826ab1fac09f95f7fa41f006009fc63aada8824 (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
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
<script lang="ts">
  import { afterNavigate, beforeNavigate } from "$app/navigation";
  import UserControls from "$lib/components/navbar/UserControls.svelte";

  import "./style.css";

  let isExpanded = false;

  function toggleExpanded() {
    isExpanded = !isExpanded;
  }

  afterNavigate(() => {
    isExpanded = false;
  });
</script>

<svelte:head>
  <title>Planetwars</title>
</svelte:head>

<div class="outer-container">
  <div class="navbar" class:expanded={isExpanded}>
    <div class="navbar-left">
      <a href="/" class="navbar-header">
        <img alt="logo" src="/ship.svg" height="32px'" />
        PlanetWars
      </a>
      <div class="navbar-item">
        <a href="/editor">Editor</a>
      </div>
      <div class="navbar-item">
        <a href="/leaderboard">Leaderboard</a>
      </div>
      <div class="navbar-item">
        <a href="/docs/rules">How to play</a>
      </div>
      <div class="navbar-divider" />
      <div class="navbar-item">
        <UserControls />
      </div>
    </div>
    <!-- <div class="navbar-right">
    </div> -->
    <div class="navbar-expand" on:click={toggleExpanded}>expand</div>
  </div>
  <slot />
</div>

<style lang="scss" global>
  @import "src/styles/global.scss";

  $navbarHeight: 52px;

  .outer-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
  }

  .navbar {
    height: $navbarHeight;
    // height: 52px;
    background-color: $bg-color;
    border-bottom: 1px solid;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 15px;
  }

  .navbar-left {
    display: flex;
    width: 100%;
    align-items: center;
  }

  .navbar-right {
    display: flex;
  }

  .navbar-divider {
    flex-grow: 1;
  }

  .navbar-header {
    height: $navbarHeight;
    padding-right: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .navbar-header img {
    display: block;
  }

  .navbar-header {
    font-size: 20px;
    color: #fff;
    font-weight: 500;
    text-decoration: none;
  }
  .navbar-item {
    margin: auto 0;
    padding: 0 8px;
  }
  .navbar-item a {
    font-size: 14px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
  }

  .navbar-expand {
    color: white;
    display: none;
    font-size: 16px;
    height: $navbarHeight;
  }
  @media screen and (max-width: 600px) {
    .navbar-item {
      display: none;
    }

    .navbar-divider {
      display: none;
    }

    .navbar.expanded {
      height: auto;
    }

    .navbar.expanded .navbar-left {
      flex-direction: column;
      align-items: flex-start;
    }

    .navbar.expanded .navbar-item {
      display: block;
      padding: 8px;
    }

    .navbar-right {
      display: none;
    }

    .navbar.expanded .navbar-right {
      display: flex;
    }

    .navbar-expand {
      display: flex;
      align-items: center;
    }
  }
</style>