File size: 4,168 Bytes
a6c4790
fa36083
 
 
 
 
 
 
 
 
 
 
 
a6c4790
 
 
 
 
 
fa36083
 
 
 
 
a6c4790
 
 
 
 
 
fa36083
 
 
 
 
 
a6c4790
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fa36083
 
 
 
 
 
 
 
a6c4790
 
 
 
 
 
 
 
fa36083
a6c4790
fa36083
 
1ba7983
 
 
fa36083
 
a6c4790
 
fa36083
 
 
 
a6c4790
fa36083
 
a6c4790
 
fa36083
 
 
 
a6c4790
 
 
 
 
 
fa36083
 
 
a6c4790
fa36083
 
 
 
 
a6c4790
fa36083
 
a6c4790
 
 
 
 
 
 
 
 
 
fa36083
 
 
a6c4790
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

class CustomHeader extends HTMLElement {
  connectedCallback() {
    this.attachShadow({ mode: 'open' });
    this.shadowRoot.innerHTML = `
      <style>
        :host {
          display: block;
          width: 100%;
          position: sticky;
          top: 0;
          z-index: 50;
          background-color: white;
          box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
          transition: all 0.3s ease;
        }
        
        :host(.scrolled) {
          box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        }
        
        nav {
          max-width: 1280px;
          margin: 0 auto;
          padding: 1rem 2rem;
        }
        
        .nav-link {
          position: relative;
          transition: color 0.3s ease;
        }
        
        .nav-link:hover {
          color: #2563eb;
        }
        
        .nav-link::after {
          content: '';
          position: absolute;
          bottom: -4px;
          left: 0;
          width: 0;
          height: 2px;
          background: linear-gradient(to right, #2563eb, #7c3aed);
          transition: width 0.3s ease;
        }
        
        .nav-link:hover::after {
          width: 100%;
        }
        
        .mobile-menu {
          display: none;
          transition: all 0.3s ease;
        }
        
        .mobile-menu.open {
          display: block;
        }
        
        .hamburger {
          transition: all 0.3s ease;
        }
        
        .hamburger.active {
          transform: rotate(90deg);
        }
      </style>
      <nav>
        <div class="flex justify-between items-center">
          <a href="/" class="flex items-center">
            <div class="bg-gradient-to-r from-primary to-secondary p-2 rounded-xl mr-3">
              <i data-feather="cpu" class="text-white w-6 h-6"></i>
            </div>
            <span class="text-xl font-bold text-gray-900">Fyns IT</span>
          </a>
          
          <div class="hidden md:flex items-center space-x-8">
            <a href="/" class="nav-link text-gray-700 hover:text-primary font-medium">Hjem</a>
            <a href="#ydelser" class="nav-link text-gray-700 hover:text-primary font-medium">Ydelser</a>
            <a href="#om-os" class="nav-link text-gray-700 hover:text-primary font-medium">Om os</a>
            <a href="#kontakt" class="nav-link text-gray-700 hover:text-primary font-medium">Kontakt</a>
            <a href="#kontakt" class="bg-primary hover:bg-blue-700 text-white font-medium py-2 px-6 rounded-lg transition duration-300 shadow hover:shadow-md">Få tilbud</a>
          </div>
          
          <button id="mobile-menu-button" class="md:hidden text-gray-700 hamburger">
            <i data-feather="menu" class="w-6 h-6"></i>
          </button>
        </div>
        
        <div id="mobile-menu" class="mobile-menu mt-4 hidden">
          <div class="flex flex-col space-y-4">
            <a href="/" class="nav-link text-gray-700 hover:text-primary font-medium py-2">Hjem</a>
            <a href="#ydelser" class="nav-link text-gray-700 hover:text-primary font-medium py-2">Ydelser</a>
            <a href="#om-os" class="nav-link text-gray-700 hover:text-primary font-medium py-2">Om os</a>
            <a href="#kontakt" class="nav-link text-gray-700 hover:text-primary font-medium py-2">Kontakt</a>
            <a href="#kontakt" class="bg-primary hover:bg-blue-700 text-white font-medium py-3 px-6 rounded-lg transition duration-300 text-center mt-2">Få tilbud</a>
          </div>
        </div>
      </nav>
`;
    const mobileMenuButton = this.shadowRoot.getElementById('mobile-menu-button');
    const mobileMenu = this.shadowRoot.getElementById('mobile-menu');
    
    mobileMenuButton.addEventListener('click', () => {
      mobileMenu.classList.toggle('open');
      mobileMenuButton.classList.toggle('active');
      feather.replace();
    });

    // Header scroll effect
    window.addEventListener('scroll', () => {
      if (window.scrollY > 10) {
        this.classList.add('scrolled');
      } else {
        this.classList.remove('scrolled');
      }
    });
}
  }
}

customElements.define('custom-header', CustomHeader);