File size: 2,425 Bytes
4d17102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
class CustomContactForm extends HTMLElement {
    connectedCallback() {
        this.attachShadow({ mode: 'open' });
        this.shadowRoot.innerHTML = `
            <style>
                :host {
                    display: block;
                }
                
                .form-input {
                    transition: all 0.3s ease;
                    border: 1px solid #e5e7eb;
                }
                
                .form-input:focus {
                    border-color: #6366f1;
                    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
                }
            </style>
            
            <form class="bg-white rounded-xl shadow-lg p-8">
                <div class="mb-6">
                    <label for="name" class="block text-gray-700 font-medium mb-2">Name</label>
                    <input type="text" id="name" name="name" required 
                        class="form-input w-full px-4 py-3 rounded-lg border focus:outline-none">
                </div>
                
                <div class="mb-6">
                    <label for="email" class="block text-gray-700 font-medium mb-2">Email</label>
                    <input type="email" id="email" name="email" required 
                        class="form-input w-full px-4 py-3 rounded-lg border focus:outline-none">
                </div>
                
                <div class="mb-6">
                    <label for="subject" class="block text-gray-700 font-medium mb-2">Subject</label>
                    <input type="text" id="subject" name="subject" 
                        class="form-input w-full px-4 py-3 rounded-lg border focus:outline-none">
                </div>
                
                <div class="mb-6">
                    <label for="message" class="block text-gray-700 font-medium mb-2">Message</label>
                    <textarea id="message" name="message" rows="5" required 
                        class="form-input w-full px-4 py-3 rounded-lg border focus:outline-none"></textarea>
                </div>
                
                <button type="submit" 
                    class="w-full bg-indigo-600 text-white font-semibold px-6 py-3 rounded-lg hover:bg-indigo-700 transition-all duration-300">
                    Send Message
                </button>
            </form>
        `;
    }
}

customElements.define('custom-contact-form', CustomContactForm);