aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server/src/routes/__layout.svelte
blob: 6d00a5f463b8cf4eda0b189198a84176da77100d (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
<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>

<div class="outer-container">
  <div class="navbar" class:expanded={isExpanded}>
    <div class="navbar-left">
      <div class="navbar-header">
        <a href="/">PlanetWars</a>
      </div>
      <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>
      <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: 48px;

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

  .navbar {
    height: $navbarHeight;
    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%;
  }

  .navbar-right {
    display: flex;
  }

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

  .navbar-header {
    height: $navbarHeight;
    padding-top: 12px;
    padding-right: 24px;
  }

  .navbar-header a {
    font-size: 20px;
    color: #fff;
    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;
    // margin: auto 0px;
    display: none;
    font-size: 16px;
    padding-top: 14px;
  }
  @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;
    }

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

    .navbar-right {
      display: none;
    }

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

    .navbar-expand {
      display: block;
    }
  }
</style>