MidouEmail commited on
Commit
1088a89
·
verified ·
1 Parent(s): 1d48793

same problem with the heading text, maybe you must delete it totally and insert new text again, and for the dropmenue its good position but ui and funtionality is zero he dont create icons after choosing the social media , its even dont give an input area fot the user handle

Browse files
Files changed (1) hide show
  1. index.html +84 -16
index.html CHANGED
@@ -56,7 +56,7 @@
56
  background: transparent !important;
57
  border: none !important;
58
  outline: none !important;
59
- z-index: 10;
60
  position: relative;
61
  }
62
  .social-dropdown {
@@ -263,14 +263,50 @@
263
  option.addEventListener('click', function(e) {
264
  e.preventDefault();
265
  const platform = this.getAttribute('data-platform');
266
- const handle = prompt(`Enter your ${platform} handle:`);
267
- if (handle) {
268
- addSocialIcon(platform, handle);
269
- }
270
- document.getElementById('socialDropdown').style.display = 'none';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
  });
272
  });
273
- // Initialize placeholder functionality
274
  document.querySelectorAll('.editable').forEach(editable => {
275
  // Clear placeholder text when focusing
276
  editable.addEventListener('focus', function() {
@@ -288,26 +324,58 @@
288
  this.style.background = 'transparent';
289
  });
290
  });
291
-
292
- // Fix for heading text visibility
293
- document.getElementById('editableName').addEventListener('focus', function() {
294
- this.style.zIndex = '20';
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  });
296
- document.getElementById('editableName').addEventListener('blur', function() {
297
- this.style.zIndex = '10';
 
 
 
 
298
  });
299
  function addSocialIcon(platform, handle) {
300
  const container = document.getElementById('socialIconsContainer');
301
  const icon = document.createElement('a');
302
  icon.href = getSocialUrl(platform, handle);
303
  icon.target = '_blank';
304
- icon.className = 'text-gray-400 hover:text-white transition';
305
- icon.innerHTML = `<i data-feather="${platform}"></i>`;
306
  container.appendChild(icon);
307
  feather.replace();
308
  }
309
 
310
- function getSocialUrl(platform, handle) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  const urls = {
312
  instagram: `https://instagram.com/${handle}`,
313
  facebook: `https://facebook.com/${handle}`,
 
56
  background: transparent !important;
57
  border: none !important;
58
  outline: none !important;
59
+ z-index: 20;
60
  position: relative;
61
  }
62
  .social-dropdown {
 
263
  option.addEventListener('click', function(e) {
264
  e.preventDefault();
265
  const platform = this.getAttribute('data-platform');
266
+
267
+ // Create modal for handle input
268
+ const modal = document.createElement('div');
269
+ modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
270
+ modal.innerHTML = `
271
+ <div class="bg-gray-800 p-6 rounded-lg max-w-sm w-full mx-4">
272
+ <h3 class="text-lg font-medium mb-4">Add your ${platform} handle</h3>
273
+ <input type="text" id="handleInput" class="w-full bg-gray-700 border border-gray-600 rounded px-3 py-2 mb-4 text-white" placeholder="Your handle">
274
+ <div class="flex justify-end space-x-2">
275
+ <button id="cancelHandle" class="px-4 py-2 text-gray-300 hover:text-white">Cancel</button>
276
+ <button id="saveHandle" class="px-4 py-2 bg-indigo-600 rounded hover:bg-indigo-700">Add</button>
277
+ </div>
278
+ </div>
279
+ `;
280
+ document.body.appendChild(modal);
281
+
282
+ const handleInput = document.getElementById('handleInput');
283
+ const cancelBtn = document.getElementById('cancelHandle');
284
+ const saveBtn = document.getElementById('saveHandle');
285
+
286
+ handleInput.focus();
287
+
288
+ cancelBtn.addEventListener('click', function() {
289
+ document.body.removeChild(modal);
290
+ });
291
+
292
+ saveBtn.addEventListener('click', function() {
293
+ const handle = handleInput.value.trim();
294
+ if (handle) {
295
+ addSocialIcon(platform, handle);
296
+ }
297
+ document.body.removeChild(modal);
298
+ document.getElementById('socialDropdown').style.display = 'none';
299
+ });
300
+
301
+ // Close modal when clicking outside
302
+ modal.addEventListener('click', function(e) {
303
+ if (e.target === modal) {
304
+ document.body.removeChild(modal);
305
+ }
306
+ });
307
  });
308
  });
309
+ // Initialize placeholder functionality
310
  document.querySelectorAll('.editable').forEach(editable => {
311
  // Clear placeholder text when focusing
312
  editable.addEventListener('focus', function() {
 
324
  this.style.background = 'transparent';
325
  });
326
  });
327
+ // Fix for heading text visibility - replace with new element
328
+ const nameElement = document.getElementById('editableName');
329
+ const newNameElement = document.createElement('h1');
330
+ newNameElement.id = 'editableName';
331
+ newNameElement.className = 'text-3xl font-bold mb-3 gradient-text editable';
332
+ newNameElement.contentEditable = 'true';
333
+ newNameElement.setAttribute('data-placeholder', 'Tap to Add your Name');
334
+ newNameElement.textContent = nameElement.textContent;
335
+
336
+ nameElement.parentNode.replaceChild(newNameElement, nameElement);
337
+
338
+ // Reinitialize event listeners for the new element
339
+ newNameElement.addEventListener('focus', function() {
340
+ if (this.textContent === this.getAttribute('data-placeholder')) {
341
+ this.textContent = '';
342
+ }
343
+ this.style.background = 'transparent';
344
  });
345
+
346
+ newNameElement.addEventListener('blur', function() {
347
+ if (this.textContent.trim() === '') {
348
+ this.textContent = '';
349
+ }
350
+ this.style.background = 'transparent';
351
  });
352
  function addSocialIcon(platform, handle) {
353
  const container = document.getElementById('socialIconsContainer');
354
  const icon = document.createElement('a');
355
  icon.href = getSocialUrl(platform, handle);
356
  icon.target = '_blank';
357
+ icon.className = 'text-gray-400 hover:text-white transition transform hover:scale-110';
358
+ icon.innerHTML = `<i data-feather="${getFeatherIconName(platform)}"></i>`;
359
  container.appendChild(icon);
360
  feather.replace();
361
  }
362
 
363
+ function getFeatherIconName(platform) {
364
+ const iconMap = {
365
+ instagram: 'instagram',
366
+ facebook: 'facebook',
367
+ twitter: 'twitter',
368
+ tiktok: 'video',
369
+ youtube: 'youtube',
370
+ linkedin: 'linkedin',
371
+ snapchat: 'camera',
372
+ pinterest: 'image',
373
+ reddit: 'message-circle',
374
+ github: 'github'
375
+ };
376
+ return iconMap[platform] || 'link';
377
+ }
378
+ function getSocialUrl(platform, handle) {
379
  const urls = {
380
  instagram: `https://instagram.com/${handle}`,
381
  facebook: `https://facebook.com/${handle}`,