File size: 989 Bytes
44c93ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0bb17ca
 
ebad138
44c93ba
 
 
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
class BackButton extends HTMLElement {
  connectedCallback() {
    this.attachShadow({ mode: 'open' });
    this.shadowRoot.innerHTML = `
      <style>
        :host {
          display: inline-block;
        }
        .back-btn {
          display: flex;
          align-items: center;
          gap: 0.5rem;
          padding: 0.5rem 1rem;
          background: var(--primary);
          color: white;
          border: none;
          border-radius: 9999px;
          cursor: pointer;
          transition: var(--transition);
        }
        .back-btn:hover {
          background: var(--primary-dark);
          transform: translateY(-2px);
        }
      </style>
      <button class="back-btn" id="backBtn">
        <i data-feather="arrow-left"></i>
        <span>Back</span>
      </button>
    `;
    this.shadowRoot.getElementById('backBtn').addEventListener('click', () => {
      window.location.href = 'index.html';
});
}
}

customElements.define('back-button', BackButton);