Spaces:
Running
Running
heading text dont work and social media add button dont work and even we dont have social media icons to show that this place is for adding social media
Browse files- index.html +186 -50
index.html
CHANGED
|
@@ -140,7 +140,7 @@
|
|
| 140 |
</div>
|
| 141 |
<!-- Editable Name -->
|
| 142 |
<div class="relative mb-3">
|
| 143 |
-
<h1 id="editableName" class="text-3xl font-bold gradient-text text-center min-h-[1.5em] px-2 py-1 rounded
|
| 144 |
</div>
|
| 145 |
<!-- Contact Button -->
|
| 146 |
<div class="relative mb-4 w-3/5 mx-auto">
|
|
@@ -150,47 +150,50 @@
|
|
| 150 |
<p id="editableTitle" class="text-xl text-gray-300 mb-4 editable" contenteditable="true" data-placeholder="Tap to Add your Title"></p>
|
| 151 |
<!-- Editable Description -->
|
| 152 |
<p id="editableDescription" class="text-base text-gray-400 mb-8 px-2 editable" contenteditable="true" data-placeholder="Tap to Add a Description about Yourself"></p>
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
|
|
|
|
|
|
|
|
|
| 194 |
<!-- Action Buttons -->
|
| 195 |
<div class="flex justify-center space-x-3 mt-auto">
|
| 196 |
<button class="px-4 py-2 bg-indigo-600 rounded-full hover:bg-indigo-700 transition text-sm">Projects</button>
|
|
@@ -306,7 +309,7 @@
|
|
| 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,6 +327,22 @@
|
|
| 324 |
this.style.background = 'transparent';
|
| 325 |
});
|
| 326 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
function addSocialIcon(platform, handle) {
|
| 328 |
const container = document.getElementById('socialIconsContainer');
|
| 329 |
|
|
@@ -391,7 +410,6 @@ function getSocialUrl(platform, handle) {
|
|
| 391 |
const phoneNumber = this.textContent.replace(/[^\d+]/g, '');
|
| 392 |
this.href = `tel:${phoneNumber}`;
|
| 393 |
});
|
| 394 |
-
|
| 395 |
// Enhanced social media dropdown positioning
|
| 396 |
const addSocialButton = document.getElementById('addSocialButton');
|
| 397 |
const socialDropdown = document.getElementById('socialDropdown');
|
|
@@ -399,13 +417,131 @@ function getSocialUrl(platform, handle) {
|
|
| 399 |
addSocialButton.addEventListener('click', function(e) {
|
| 400 |
e.stopPropagation();
|
| 401 |
const rect = addSocialButton.getBoundingClientRect();
|
| 402 |
-
|
| 403 |
-
socialDropdown.style.
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 408 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 409 |
// Save profile functionality
|
| 410 |
document.getElementById('saveProfile').addEventListener('click', function() {
|
| 411 |
const profileData = {
|
|
|
|
| 140 |
</div>
|
| 141 |
<!-- Editable Name -->
|
| 142 |
<div class="relative mb-3">
|
| 143 |
+
<h1 id="editableName" class="text-3xl font-bold gradient-text text-center min-h-[1.5em] px-2 py-1 rounded" contenteditable="true" data-placeholder="Tap to Add your Name">Tap to Add your Name</h1>
|
| 144 |
</div>
|
| 145 |
<!-- Contact Button -->
|
| 146 |
<div class="relative mb-4 w-3/5 mx-auto">
|
|
|
|
| 150 |
<p id="editableTitle" class="text-xl text-gray-300 mb-4 editable" contenteditable="true" data-placeholder="Tap to Add your Title"></p>
|
| 151 |
<!-- Editable Description -->
|
| 152 |
<p id="editableDescription" class="text-base text-gray-400 mb-8 px-2 editable" contenteditable="true" data-placeholder="Tap to Add a Description about Yourself"></p>
|
| 153 |
+
<!-- Social Media Section -->
|
| 154 |
+
<div class="mb-8">
|
| 155 |
+
<div class="flex justify-center flex-wrap gap-3 mb-4" id="socialIconsContainer">
|
| 156 |
+
<!-- Social media icons will be added here -->
|
| 157 |
+
<!-- Plus button for adding social media -->
|
| 158 |
+
<div class="relative">
|
| 159 |
+
<button id="addSocialButton" class="w-12 h-12 rounded-full bg-indigo-600 hover:bg-indigo-700 flex items-center justify-center transition">
|
| 160 |
+
<i data-feather="plus" class="w-5 h-5"></i>
|
| 161 |
+
</button>
|
| 162 |
+
<div id="socialDropdown" class="social-dropdown">
|
| 163 |
+
<a class="social-option" data-platform="instagram">
|
| 164 |
+
<i data-feather="instagram"></i> Instagram
|
| 165 |
+
</a>
|
| 166 |
+
<a class="social-option" data-platform="facebook">
|
| 167 |
+
<i data-feather="facebook"></i> Facebook
|
| 168 |
+
</a>
|
| 169 |
+
<a class="social-option" data-platform="twitter">
|
| 170 |
+
<i data-feather="twitter"></i> Twitter
|
| 171 |
+
</a>
|
| 172 |
+
<a class="social-option" data-platform="tiktok">
|
| 173 |
+
<i data-feather="video"></i> TikTok
|
| 174 |
+
</a>
|
| 175 |
+
<a class="social-option" data-platform="youtube">
|
| 176 |
+
<i data-feather="youtube"></i> YouTube
|
| 177 |
+
</a>
|
| 178 |
+
<a class="social-option" data-platform="linkedin">
|
| 179 |
+
<i data-feather="linkedin"></i> LinkedIn
|
| 180 |
+
</a>
|
| 181 |
+
<a class="social-option" data-platform="snapchat">
|
| 182 |
+
<i data-feather="camera"></i> Snapchat
|
| 183 |
+
</a>
|
| 184 |
+
<a class="social-option" data-platform="pinterest">
|
| 185 |
+
<i data-feather="image"></i> Pinterest
|
| 186 |
+
</a>
|
| 187 |
+
<a class="social-option" data-platform="reddit">
|
| 188 |
+
<i data-feather="message-circle"></i> Reddit
|
| 189 |
+
</a>
|
| 190 |
+
<a class="social-option" data-platform="github">
|
| 191 |
+
<i data-feather="github"></i> GitHub
|
| 192 |
+
</a>
|
| 193 |
+
</div>
|
| 194 |
+
</div>
|
| 195 |
+
</div>
|
| 196 |
+
</div>
|
| 197 |
<!-- Action Buttons -->
|
| 198 |
<div class="flex justify-center space-x-3 mt-auto">
|
| 199 |
<button class="px-4 py-2 bg-indigo-600 rounded-full hover:bg-indigo-700 transition text-sm">Projects</button>
|
|
|
|
| 309 |
});
|
| 310 |
});
|
| 311 |
});
|
| 312 |
+
// Initialize placeholder functionality for all editable elements except heading
|
| 313 |
document.querySelectorAll('.editable').forEach(editable => {
|
| 314 |
// Clear placeholder text when focusing
|
| 315 |
editable.addEventListener('focus', function() {
|
|
|
|
| 327 |
this.style.background = 'transparent';
|
| 328 |
});
|
| 329 |
});
|
| 330 |
+
|
| 331 |
+
// Special handling for heading element
|
| 332 |
+
const editableName = document.getElementById('editableName');
|
| 333 |
+
editableName.addEventListener('focus', function() {
|
| 334 |
+
if (this.textContent === this.getAttribute('data-placeholder')) {
|
| 335 |
+
this.textContent = '';
|
| 336 |
+
}
|
| 337 |
+
this.style.background = 'transparent';
|
| 338 |
+
});
|
| 339 |
+
|
| 340 |
+
editableName.addEventListener('blur', function() {
|
| 341 |
+
if (this.textContent.trim() === '') {
|
| 342 |
+
this.textContent = this.getAttribute('data-placeholder');
|
| 343 |
+
}
|
| 344 |
+
this.style.background = 'transparent';
|
| 345 |
+
});
|
| 346 |
function addSocialIcon(platform, handle) {
|
| 347 |
const container = document.getElementById('socialIconsContainer');
|
| 348 |
|
|
|
|
| 410 |
const phoneNumber = this.textContent.replace(/[^\d+]/g, '');
|
| 411 |
this.href = `tel:${phoneNumber}`;
|
| 412 |
});
|
|
|
|
| 413 |
// Enhanced social media dropdown positioning
|
| 414 |
const addSocialButton = document.getElementById('addSocialButton');
|
| 415 |
const socialDropdown = document.getElementById('socialDropdown');
|
|
|
|
| 417 |
addSocialButton.addEventListener('click', function(e) {
|
| 418 |
e.stopPropagation();
|
| 419 |
const rect = addSocialButton.getBoundingClientRect();
|
| 420 |
+
const isVisible = socialDropdown.style.display === 'block';
|
| 421 |
+
socialDropdown.style.display = isVisible ? 'none' : 'block';
|
| 422 |
+
|
| 423 |
+
if (!isVisible) {
|
| 424 |
+
socialDropdown.style.bottom = '100%';
|
| 425 |
+
socialDropdown.style.top = 'auto';
|
| 426 |
+
socialDropdown.style.left = '50%';
|
| 427 |
+
socialDropdown.style.transform = 'translateX(-50%)';
|
| 428 |
+
socialDropdown.style.marginBottom = '8px';
|
| 429 |
+
}
|
| 430 |
});
|
| 431 |
+
|
| 432 |
+
// Social media platform selection
|
| 433 |
+
document.querySelectorAll('.social-option').forEach(option => {
|
| 434 |
+
option.addEventListener('click', function(e) {
|
| 435 |
+
e.preventDefault();
|
| 436 |
+
const platform = this.getAttribute('data-platform');
|
| 437 |
+
|
| 438 |
+
// Create modal for handle input
|
| 439 |
+
const modal = document.createElement('div');
|
| 440 |
+
modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
|
| 441 |
+
modal.innerHTML = `
|
| 442 |
+
<div class="bg-gray-800 p-6 rounded-lg max-w-sm w-full mx-4">
|
| 443 |
+
<h3 class="text-lg font-medium mb-4">Add your ${platform} handle</h3>
|
| 444 |
+
<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">
|
| 445 |
+
<div class="flex justify-end space-x-2">
|
| 446 |
+
<button id="cancelHandle" class="px-4 py-2 text-gray-300 hover:text-white">Cancel</button>
|
| 447 |
+
<button id="saveHandle" class="px-4 py-2 bg-indigo-600 rounded hover:bg-indigo-700">Add</button>
|
| 448 |
+
</div>
|
| 449 |
+
</div>
|
| 450 |
+
`;
|
| 451 |
+
document.body.appendChild(modal);
|
| 452 |
+
|
| 453 |
+
const handleInput = document.getElementById('handleInput');
|
| 454 |
+
const cancelBtn = document.getElementById('cancelHandle');
|
| 455 |
+
const saveBtn = document.getElementById('saveHandle');
|
| 456 |
+
|
| 457 |
+
handleInput.focus();
|
| 458 |
+
|
| 459 |
+
cancelBtn.addEventListener('click', function() {
|
| 460 |
+
document.body.removeChild(modal);
|
| 461 |
+
});
|
| 462 |
+
|
| 463 |
+
saveBtn.addEventListener('click', function() {
|
| 464 |
+
const handle = handleInput.value.trim();
|
| 465 |
+
if (handle) {
|
| 466 |
+
addSocialIcon(platform, handle);
|
| 467 |
+
}
|
| 468 |
+
document.body.removeChild(modal);
|
| 469 |
+
document.getElementById('socialDropdown').style.display = 'none';
|
| 470 |
+
});
|
| 471 |
+
|
| 472 |
+
// Close modal when clicking outside
|
| 473 |
+
modal.addEventListener('click', function(e) {
|
| 474 |
+
if (e.target === modal) {
|
| 475 |
+
document.body.removeChild(modal);
|
| 476 |
+
}
|
| 477 |
+
});
|
| 478 |
+
});
|
| 479 |
+
});
|
| 480 |
+
|
| 481 |
+
function addSocialIcon(platform, handle) {
|
| 482 |
+
const container = document.getElementById('socialIconsContainer');
|
| 483 |
+
|
| 484 |
+
// Create social icon element
|
| 485 |
+
const iconWrapper = document.createElement('div');
|
| 486 |
+
iconWrapper.className = 'relative group';
|
| 487 |
+
|
| 488 |
+
const icon = document.createElement('a');
|
| 489 |
+
icon.href = getSocialUrl(platform, handle);
|
| 490 |
+
icon.target = '_blank';
|
| 491 |
+
icon.className = 'w-12 h-12 rounded-full bg-gray-800 hover:bg-indigo-600 flex items-center justify-center transition transform hover:scale-110';
|
| 492 |
+
icon.innerHTML = `<i data-feather="${getFeatherIconName(platform)}" class="w-5 h-5"></i>`;
|
| 493 |
+
|
| 494 |
+
// Add remove button
|
| 495 |
+
const removeBtn = document.createElement('button');
|
| 496 |
+
removeBtn.className = 'absolute -top-1 -right-1 w-4 h-4 bg-red-500 rounded-full text-white text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition';
|
| 497 |
+
removeBtn.innerHTML = '×';
|
| 498 |
+
removeBtn.onclick = function(e) {
|
| 499 |
+
e.preventDefault();
|
| 500 |
+
e.stopPropagation();
|
| 501 |
+
container.removeChild(iconWrapper);
|
| 502 |
+
};
|
| 503 |
+
|
| 504 |
+
iconWrapper.appendChild(icon);
|
| 505 |
+
iconWrapper.appendChild(removeBtn);
|
| 506 |
+
|
| 507 |
+
// Insert before the plus button container
|
| 508 |
+
const addButtonContainer = container.querySelector('.relative');
|
| 509 |
+
container.insertBefore(iconWrapper, addButtonContainer);
|
| 510 |
+
|
| 511 |
+
feather.replace();
|
| 512 |
+
}
|
| 513 |
+
|
| 514 |
+
function getFeatherIconName(platform) {
|
| 515 |
+
const iconMap = {
|
| 516 |
+
instagram: 'instagram',
|
| 517 |
+
facebook: 'facebook',
|
| 518 |
+
twitter: 'twitter',
|
| 519 |
+
tiktok: 'video',
|
| 520 |
+
youtube: 'youtube',
|
| 521 |
+
linkedin: 'linkedin',
|
| 522 |
+
snapchat: 'camera',
|
| 523 |
+
pinterest: 'image',
|
| 524 |
+
reddit: 'message-circle',
|
| 525 |
+
github: 'github'
|
| 526 |
+
};
|
| 527 |
+
return iconMap[platform] || 'link';
|
| 528 |
+
}
|
| 529 |
+
|
| 530 |
+
function getSocialUrl(platform, handle) {
|
| 531 |
+
const urls = {
|
| 532 |
+
instagram: `https://instagram.com/${handle}`,
|
| 533 |
+
facebook: `https://facebook.com/${handle}`,
|
| 534 |
+
twitter: `https://twitter.com/${handle}`,
|
| 535 |
+
tiktok: `https://tiktok.com/@${handle}`,
|
| 536 |
+
youtube: `https://youtube.com/@${handle}`,
|
| 537 |
+
linkedin: `https://linkedin.com/in/${handle}`,
|
| 538 |
+
snapchat: `https://snapchat.com/add/${handle}`,
|
| 539 |
+
pinterest: `https://pinterest.com/${handle}`,
|
| 540 |
+
reddit: `https://reddit.com/user/${handle}`,
|
| 541 |
+
github: `https://github.com/${handle}`
|
| 542 |
+
};
|
| 543 |
+
return urls[platform] || '#';
|
| 544 |
+
}
|
| 545 |
// Save profile functionality
|
| 546 |
document.getElementById('saveProfile').addEventListener('click', function() {
|
| 547 |
const profileData = {
|