Worldwide88 commited on
Commit
e4d17d2
·
verified ·
1 Parent(s): 50bff09

its the exact same website

Browse files
Files changed (2) hide show
  1. components/navbar.js +120 -6
  2. index.html +2 -1
components/navbar.js CHANGED
@@ -1,5 +1,93 @@
 
1
  class CustomNavbar extends HTMLElement {
 
 
 
 
 
2
  connectedCallback() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  this.attachShadow({ mode: 'open' });
4
  this.shadowRoot.innerHTML = `
5
  <style>
@@ -75,15 +163,34 @@ class CustomNavbar extends HTMLElement {
75
  transform: translateY(-2px);
76
  box-shadow: 0 4px 12px rgba(58, 90, 255, 0.25);
77
  }
78
-
79
  .mobile-menu-button {
80
  display: none;
81
  background: none;
82
  border: none;
83
  cursor: pointer;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  }
85
 
86
- @media (max-width: 768px) {
 
 
 
87
  .nav-links {
88
  display: none;
89
  }
@@ -105,10 +212,17 @@ class CustomNavbar extends HTMLElement {
105
  <a href="/#about" class="nav-link">Om oss</a>
106
  <a href="/#nyheter" class="nav-link">Nyheter</a>
107
  <a href="/#bokademo" class="cta-button">Boka demo</a>
108
- </div>
109
-
110
- <button class="mobile-menu-button">
111
- <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor">
 
 
 
 
 
 
 
112
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
113
  </svg>
114
  </button>
 
1
+
2
  class CustomNavbar extends HTMLElement {
3
+ constructor() {
4
+ super();
5
+ this.isMobileMenuOpen = false;
6
+ }
7
+
8
  connectedCallback() {
9
+ this.attachShadow({ mode: 'open' });
10
+ this.render();
11
+
12
+ const menuButton = this.shadowRoot.querySelector('.mobile-menu-button');
13
+ menuButton.addEventListener('click', () => this.toggleMobileMenu());
14
+ }
15
+
16
+ toggleMobileMenu() {
17
+ this.isMobileMenuOpen = !this.isMobileMenuOpen;
18
+ const menu = this.shadowRoot.querySelector('.mobile-menu');
19
+ menu.classList.toggle('open', this.isMobileMenuOpen);
20
+ }
21
+
22
+ render() {
23
+ this.shadowRoot.innerHTML = `
24
+ <style>
25
+ /* Previous styles remain the same */
26
+ :host {
27
+ display: block;
28
+ position: fixed;
29
+ top: 0;
30
+ left: 0;
31
+ right: 0;
32
+ z-index: 1000;
33
+ background: rgba(255, 255, 255, 0.98);
34
+ backdrop-filter: blur(10px);
35
+ box-shadow: 0 2px 10px rgba(0,0,0,0.05);
36
+ transition: all 0.3s ease;
37
+ }
38
+
39
+ /* Add the new mobile menu styles here */
40
+ .mobile-menu {
41
+ display: none;
42
+ position: fixed;
43
+ top: 0;
44
+ left: 0;
45
+ right: 0;
46
+ bottom: 0;
47
+ background: white;
48
+ z-index: 1000;
49
+ flex-direction: column;
50
+ align-items: center;
51
+ justify-content: center;
52
+ gap: 2rem;
53
+ padding: 2rem;
54
+ }
55
+
56
+ .mobile-menu.open {
57
+ display: flex;
58
+ }
59
+ </style>
60
+
61
+ <div class="navbar-container">
62
+ <a href="/">
63
+ <img src="//images.squarespace-cdn.com/content/v1/685a95ba7148ac0764b72458/d6945097-31b0-4bad-8c6a-b583eacf0745/SS_logo.png?format=1500w" alt="SafeSwitch" class="logo">
64
+ </a>
65
+
66
+ <div class="nav-links">
67
+ <a href="/#privatpersoner" class="nav-link">För privatpersoner</a>
68
+ <a href="/#foretag" class="nav-link">För företag</a>
69
+ <a href="/#about" class="nav-link">Om oss</a>
70
+ <a href="/#nyheter" class="nav-link">Nyheter</a>
71
+ <a href="/#bokademo" class="cta-button">Boka demo</a>
72
+ </div>
73
+
74
+ <button class="mobile-menu-button" aria-label="Toggle menu">
75
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor">
76
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
77
+ </svg>
78
+ </button>
79
+ </div>
80
+
81
+ <div class="mobile-menu">
82
+ <a href="/#privatpersoner" class="nav-link">För privatpersoner</a>
83
+ <a href="/#foretag" class="nav-link">För företag</a>
84
+ <a href="/#about" class="nav-link">Om oss</a>
85
+ <a href="/#nyheter" class="nav-link">Nyheter</a>
86
+ <a href="/#bokademo" class="cta-button">Boka demo</a>
87
+ </div>
88
+ `;
89
+ }
90
+ connectedCallback() {
91
  this.attachShadow({ mode: 'open' });
92
  this.shadowRoot.innerHTML = `
93
  <style>
 
163
  transform: translateY(-2px);
164
  box-shadow: 0 4px 12px rgba(58, 90, 255, 0.25);
165
  }
 
166
  .mobile-menu-button {
167
  display: none;
168
  background: none;
169
  border: none;
170
  cursor: pointer;
171
+ z-index: 1001;
172
+ }
173
+
174
+ .mobile-menu {
175
+ display: none;
176
+ position: fixed;
177
+ top: 0;
178
+ left: 0;
179
+ right: 0;
180
+ bottom: 0;
181
+ background: white;
182
+ z-index: 1000;
183
+ flex-direction: column;
184
+ align-items: center;
185
+ justify-content: center;
186
+ gap: 2rem;
187
+ padding: 2rem;
188
  }
189
 
190
+ .mobile-menu.open {
191
+ display: flex;
192
+ }
193
+ @media (max-width: 768px) {
194
  .nav-links {
195
  display: none;
196
  }
 
212
  <a href="/#about" class="nav-link">Om oss</a>
213
  <a href="/#nyheter" class="nav-link">Nyheter</a>
214
  <a href="/#bokademo" class="cta-button">Boka demo</a>
215
+ </div>
216
+
217
+ <div class="mobile-menu">
218
+ <a href="/#privatpersoner" class="nav-link">För privatpersoner</a>
219
+ <a href="/#foretag" class="nav-link">För företag</a>
220
+ <a href="/#about" class="nav-link">Om oss</a>
221
+ <a href="/#nyheter" class="nav-link">Nyheter</a>
222
+ <a href="/#bokademo" class="cta-button">Boka demo</a>
223
+ </div>
224
+ <button class="mobile-menu-button" aria-label="Toggle menu">
225
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor">
226
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
227
  </svg>
228
  </button>
index.html CHANGED
@@ -4,7 +4,8 @@
4
  <head>
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
  <meta name="viewport" content="width=device-width, initial-scale=1">
7
- <!-- This is Squarespace. --><!-- trout-turkey-5yx3 -->
 
8
  <base href="">
9
  <meta charset="utf-8" />
10
  <title>SafeSwitch</title>
 
4
  <head>
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
  <meta name="viewport" content="width=device-width, initial-scale=1">
7
+ <custom-navbar></custom-navbar>
8
+ <script src="components/navbar.js"></script>
9
  <base href="">
10
  <meta charset="utf-8" />
11
  <title>SafeSwitch</title>