support-kurdistan 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.html ADDED
@@ -0,0 +1,42 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Support Kurdistan Header Demo</title>
7
+ <script type="module" src="./src/support-kurdistan.js"></script>
8
+ </head>
9
+ <body>
10
+ <support-kurdistan
11
+ locale="en"
12
+ theme="light"
13
+ mode="top"
14
+ >
15
+ </support-kurdistan>
16
+
17
+ <br>
18
+
19
+ <support-kurdistan
20
+ text="Custom support message"
21
+ theme="dark"
22
+ >
23
+ </support-kurdistan>
24
+
25
+ <br>
26
+
27
+ <support-kurdistan
28
+ locale="ar"
29
+ theme="minimal"
30
+ >
31
+ </support-kurdistan>
32
+
33
+ <br>
34
+
35
+ <support-kurdistan
36
+ locale="ckb"
37
+ theme="dark"
38
+ title="hello"
39
+ >
40
+ </support-kurdistan>
41
+ </body>
42
+ </html>
package/package.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "support-kurdistan",
3
+ "version": "1.0.0",
4
+ "main": "support-kurdistan.js",
5
+ "type": "module",
6
+ "author": "Abdulsamad Zuhair"
7
+ }
@@ -0,0 +1,206 @@
1
+ class SupportKurdistan extends HTMLElement {
2
+ connectedCallback() {
3
+ const locale = this.getAttribute("locale") || "en";
4
+ const theme = this.getAttribute("theme") || "light";
5
+ const customText = this.getAttribute("text") || "";
6
+ const mode = this.getAttribute("mode") || "top";
7
+
8
+ const translations = {
9
+ en: "We stand with Kurdistan",
10
+ ku: "ئێمە لەگەڵ کوردستانین",
11
+ ckb: "ئێمە لەگەڵ کوردستانین",
12
+ ar: "نحن نقف مع كوردستان"
13
+ };
14
+
15
+ const hashtags = ["#SaveRojavaPeople", "#FreeRojava", "#SaveKurdistan"];
16
+
17
+ const themes = {
18
+ light: {
19
+ bg: "#ffffff",
20
+ color: "#333333",
21
+ border: "#e8e8e8",
22
+ accent: "#c0392b",
23
+ shadow: "0 2px 12px rgba(0, 0, 0, 0.08)"
24
+ },
25
+ dark: {
26
+ bg: "#1a1a1a",
27
+ color: "#f5f5f5",
28
+ border: "#333333",
29
+ accent: "#e74c3c",
30
+ shadow: "0 2px 12px rgba(0, 0, 0, 0.2)"
31
+ },
32
+ subtle: {
33
+ bg: "#f9f9f9",
34
+ color: "#444444",
35
+ border: "#e0e0e0",
36
+ accent: "#2980b9",
37
+ shadow: "0 1px 6px rgba(0, 0, 0, 0.05)"
38
+ }
39
+ };
40
+
41
+ const t = themes[theme] || themes.light;
42
+ const isRTL = ['ar', 'ku', 'ckb'].includes(locale);
43
+
44
+ const positionStyle = mode === "footer"
45
+ ? "margin-top: auto;"
46
+ : "position: sticky; top: 0; z-index: 100;";
47
+
48
+ this.attachShadow({ mode: "open" });
49
+
50
+ this.shadowRoot.innerHTML = `
51
+ <style>
52
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');
53
+
54
+ :host {
55
+ display: block;
56
+ }
57
+
58
+ .banner {
59
+ ${positionStyle}
60
+ width: 100%;
61
+ background: ${t.bg};
62
+ border-bottom: 1px solid ${t.border};
63
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
64
+ }
65
+
66
+ .banner-content {
67
+ max-width: 1200px;
68
+ margin: 0 auto;
69
+ padding: 12px 20px;
70
+ display: flex;
71
+ justify-content: space-between;
72
+ align-items: center;
73
+ gap: 20px;
74
+ }
75
+
76
+ .left-content {
77
+ display: flex;
78
+ align-items: center;
79
+ gap: 16px;
80
+ flex: 1;
81
+ }
82
+
83
+ .right-content {
84
+ display: flex;
85
+ align-items: center;
86
+ gap: 20px;
87
+ }
88
+
89
+ .flag-container {
90
+ width: 36px;
91
+ height: 36px;
92
+ flex-shrink: 0;
93
+ }
94
+
95
+ .flag {
96
+ width: 100%;
97
+ height: 100%;
98
+ object-fit: contain;
99
+ filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
100
+ }
101
+
102
+ .message {
103
+ font-family: 'Inter', sans-serif;
104
+ font-size: 16px;
105
+ font-weight: 500;
106
+ line-height: 1.4;
107
+ margin: 0;
108
+ direction: ${isRTL ? 'rtl' : 'ltr'};
109
+ text-align: ${isRTL ? 'right' : 'left'};
110
+ color: ${t.color};
111
+ }
112
+
113
+ .hashtag {
114
+ font-family: 'Inter', sans-serif;
115
+ font-size: 14px;
116
+ font-weight: 500;
117
+ color: ${t.accent};
118
+ text-decoration: none;
119
+ transition: opacity 0.2s ease;
120
+ white-space: nowrap;
121
+ }
122
+
123
+ .hashtag:hover {
124
+ opacity: 0.8;
125
+ }
126
+
127
+ .heart {
128
+ color: #e74c3c;
129
+ display: inline-block;
130
+ margin-left: 6px;
131
+ }
132
+
133
+ @media (max-width: 768px) {
134
+ .banner-content {
135
+ flex-direction: column;
136
+ gap: 12px;
137
+ padding: 10px 16px;
138
+ }
139
+
140
+ .left-content {
141
+ width: 100%;
142
+ justify-content: center;
143
+ text-align: center;
144
+ }
145
+
146
+ .right-content {
147
+ width: 100%;
148
+ justify-content: center;
149
+ flex-wrap: wrap;
150
+ gap: 12px;
151
+ }
152
+
153
+ .message {
154
+ font-size: 15px;
155
+ }
156
+
157
+ .hashtag {
158
+ font-size: 13px;
159
+ }
160
+ }
161
+
162
+ @media (max-width: 480px) {
163
+ .right-content {
164
+ gap: 8px;
165
+ }
166
+
167
+ .hashtag {
168
+ font-size: 12px;
169
+ }
170
+ }
171
+ </style>
172
+
173
+ <div class="banner">
174
+ <div class="banner-content">
175
+ <div class="left-content">
176
+ <div class="flag-container">
177
+ <img class="flag"
178
+ src="https://cdn-icons-png.flaticon.com/512/10600/10600720.png"
179
+ alt="Kurdistan Map">
180
+ </div>
181
+ <p class="message">
182
+ ${customText || (translations[locale] || translations.en)}
183
+ ${!customText ? '<span class="heart">❤️</span>' : ''}
184
+ </p>
185
+ </div>
186
+
187
+ <div class="right-content">
188
+ ${hashtags.map(tag =>
189
+ `<a href="#" class="hashtag">${tag}</a>`
190
+ ).join('')}
191
+ </div>
192
+ </div>
193
+ </div>
194
+ `;
195
+
196
+ // Add click handlers for hashtags
197
+ this.shadowRoot.querySelectorAll('.hashtag').forEach((link, index) => {
198
+ link.addEventListener('click', (e) => {
199
+ e.preventDefault();
200
+ window.open(`https://twitter.com/search?q=${encodeURIComponent(hashtags[index])}`, '_blank');
201
+ });
202
+ });
203
+ }
204
+ }
205
+
206
+ customElements.define("support-kurdistan", SupportKurdistan);