File size: 1,719 Bytes
d48db9e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
class ApiConnector extends HTMLElement {
  connectedCallback() {
    this.attachShadow({ mode: 'open' });
    this.shadowRoot.innerHTML = `
      <style>
        :host {
          display: block;
          margin: 1rem 0;
        }
        .connector {
          border: 1px solid #e5e7eb;
          border-radius: 8px;
          padding: 1rem;
          background: #f9fafb;
        }
        .header {
          display: flex;
          align-items: center;
          margin-bottom: 0.5rem;
        }
        .icon {
          width: 24px;
          height: 24px;
          margin-right: 0.5rem;
        }
        h3 {
          margin: 0;
          font-size: 1rem;
          font-weight: 600;
        }
        .actions {
          display: flex;
          gap: 0.5rem;
          margin-top: 0.75rem;
        }
        button {
          padding: 0.25rem 0.5rem;
          font-size: 0.875rem;
          border-radius: 4px;
          cursor: pointer;
        }
        .connect {
          background: #3b82f6;
          color: white;
          border: none;
        }
        .docs {
          background: white;
          border: 1px solid #e5e7eb;
        }
      </style>
      <div class="connector">
        <div class="header">
          <img src="http://static.photos/technology/200x200/${Math.floor(Math.random() * 100)}" class="icon">
          <h3><slot name="name">API Connector</slot></h3>
        </div>
        <div><slot name="description">Connect to external APIs</slot></div>
        <div class="actions">
          <button class="connect">Connect</button>
          <button class="docs">Docs</button>
        </div>
      </div>
    `;
  }
}

customElements.define('api-connector', ApiConnector);