Spaces:
Running

File size: 2,214 Bytes
c7419b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
class CustomToolbar extends HTMLElement {
  connectedCallback() {
    this.attachShadow({ mode: 'open' });
    this.shadowRoot.innerHTML = `
      <style>
        .tool-button {
          width: 40px;
          height: 40px;
          display: flex;
          align-items: center;
          justify-content: center;
          border-radius: 8px;
          transition: all 0.2s;
        }
        .tool-button:hover {
          background-color: #e0e7ff;
          transform: scale(1.05);
        }
        .tool-button.active {
          background-color: #6366f1;
          color: white;
        }
      </style>
      <div class="bg-white rounded-xl shadow-lg p-4 w-full lg:w-16 flex lg:flex-row flex-wrap justify-center gap-2 lg:flex-col">
        <h3 class="text-lg font-semibold mb-3 text-gray-700 lg:hidden">Drawing Tools</h3>
        <button class="tool-button active" title="Pen">
          <i data-feather="edit-2" class="w-5 h-5"></i>
        </button>
        <button class="tool-button" title="Brush">
          <i data-feather="brush" class="w-5 h-5"></i>
        </button>
        <button class="tool-button" title="Line">
          <i data-feather="minus" class="w-5 h-5"></i>
        </button>
        <button class="tool-button" title="Shape">
          <i data-feather="square" class="w-5 h-5"></i>
        </button>
        <button class="tool-button" title="Text">
          <i data-feather="type" class="w-5 h-5"></i>
        </button>
        <button class="tool-button" title="Eraser">
          <i data-feather="x" class="w-5 h-5"></i>
        </button>
        <div class="border-t border-gray-200 my-2 lg:my-0 lg:mx-0"></div>
        <button class="tool-button" title="Undo" onclick="alert('Undo functionality')">
          <i data-feather="rotate-ccw" class="w-5 h-5"></i>
        </button>
        <button class="tool-button" title="Redo" onclick="alert('Redo functionality')">
          <i data-feather="rotate-cw" class="w-5 h-5"></i>
        </button>
        <button class="tool-button" title="Clear" onclick="clearCanvas()">
          <i data-feather="trash-2" class="w-5 h-5"></i>
        </button>
      </div>
    `;
  }
}
customElements.define('custom-toolbar', CustomToolbar);