Spaces:
Running
Running
the heading text still dont work, the social media box is working but like i want maybe its better if we ttreat it like another element so it will show social media account like placeholder and add button with plus icon so when user press the plus button he can choose the social media icon he want and add his handle and the icon appear really and the plus icon still can be used to add another another icons
Browse files- index.html +93 -53
index.html
CHANGED
|
@@ -138,9 +138,11 @@
|
|
| 138 |
</div>
|
| 139 |
<input type="file" id="imageUpload" accept="image/*" class="hidden">
|
| 140 |
</div>
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
|
|
|
|
|
|
| 144 |
<div class="relative mb-4 w-3/5 mx-auto">
|
| 145 |
<a id="contactButton" href="tel:" class="px-4 py-2 border border-indigo-500 rounded-full hover:bg-indigo-900/30 transition text-xs w-full block editable" contenteditable="true" data-placeholder="Tap to Add Phone Number"></a>
|
| 146 |
</div>
|
|
@@ -148,49 +150,47 @@
|
|
| 148 |
<p id="editableTitle" class="text-xl text-gray-300 mb-4 editable" contenteditable="true" data-placeholder="Tap to Add your Title"></p>
|
| 149 |
<!-- Editable Description -->
|
| 150 |
<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>
|
| 151 |
-
|
| 152 |
-
|
| 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 |
-
</div>
|
| 193 |
-
</div>
|
| 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>
|
|
@@ -351,16 +351,37 @@
|
|
| 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 = '
|
| 358 |
-
icon.innerHTML = `<i data-feather="${getFeatherIconName(platform)}"></i>`;
|
| 359 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 360 |
feather.replace();
|
| 361 |
}
|
| 362 |
-
|
| 363 |
-
function getFeatherIconName(platform) {
|
| 364 |
const iconMap = {
|
| 365 |
instagram: 'instagram',
|
| 366 |
facebook: 'facebook',
|
|
@@ -390,14 +411,27 @@ function getSocialUrl(platform, handle) {
|
|
| 390 |
};
|
| 391 |
return urls[platform] || '#';
|
| 392 |
}
|
| 393 |
-
|
| 394 |
// Update contact button href when editing
|
| 395 |
document.getElementById('contactButton').addEventListener('input', function() {
|
| 396 |
const phoneNumber = this.textContent.replace(/[^\d+]/g, '');
|
| 397 |
this.href = `tel:${phoneNumber}`;
|
| 398 |
});
|
| 399 |
|
| 400 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
document.getElementById('saveProfile').addEventListener('click', function() {
|
| 402 |
const profileData = {
|
| 403 |
name: document.getElementById('editableName').textContent,
|
|
@@ -417,7 +451,10 @@ function getSocialUrl(platform, handle) {
|
|
| 417 |
// Set content only if it's not empty or placeholder
|
| 418 |
if (profileData.name && profileData.name !== 'Tap to Add your Name') {
|
| 419 |
document.getElementById('editableName').textContent = profileData.name;
|
|
|
|
|
|
|
| 420 |
}
|
|
|
|
| 421 |
if (profileData.title && profileData.title !== 'Tap to Add your Title') {
|
| 422 |
document.getElementById('editableTitle').textContent = profileData.title;
|
| 423 |
}
|
|
@@ -431,6 +468,9 @@ function getSocialUrl(platform, handle) {
|
|
| 431 |
if (profileData.image && profileData.image !== 'http://static.photos/technology/320x240/42') {
|
| 432 |
document.getElementById('profileImage').src = profileData.image;
|
| 433 |
}
|
|
|
|
|
|
|
|
|
|
| 434 |
}
|
| 435 |
</script>
|
| 436 |
</body>
|
|
|
|
| 138 |
</div>
|
| 139 |
<input type="file" id="imageUpload" accept="image/*" class="hidden">
|
| 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"></h1>
|
| 144 |
+
</div>
|
| 145 |
+
<!-- Contact Button -->
|
| 146 |
<div class="relative mb-4 w-3/5 mx-auto">
|
| 147 |
<a id="contactButton" href="tel:" class="px-4 py-2 border border-indigo-500 rounded-full hover:bg-indigo-900/30 transition text-xs w-full block editable" contenteditable="true" data-placeholder="Tap to Add Phone Number"></a>
|
| 148 |
</div>
|
|
|
|
| 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 |
+
<!-- Plus button for adding social media -->
|
| 157 |
+
<button id="addSocialButton" class="w-12 h-12 rounded-full bg-indigo-600 hover:bg-indigo-700 flex items-center justify-center transition">
|
| 158 |
+
<i data-feather="plus" class="w-5 h-5"></i>
|
| 159 |
+
</button>
|
| 160 |
+
</div>
|
| 161 |
+
<div id="socialDropdown" class="social-dropdown">
|
| 162 |
+
<a class="social-option" data-platform="instagram">
|
| 163 |
+
<i data-feather="instagram"></i> Instagram
|
| 164 |
+
</a>
|
| 165 |
+
<a class="social-option" data-platform="facebook">
|
| 166 |
+
<i data-feather="facebook"></i> Facebook
|
| 167 |
+
</a>
|
| 168 |
+
<a class="social-option" data-platform="twitter">
|
| 169 |
+
<i data-feather="twitter"></i> Twitter
|
| 170 |
+
</a>
|
| 171 |
+
<a class="social-option" data-platform="tiktok">
|
| 172 |
+
<i data-feather="video"></i> TikTok
|
| 173 |
+
</a>
|
| 174 |
+
<a class="social-option" data-platform="youtube">
|
| 175 |
+
<i data-feather="youtube"></i> YouTube
|
| 176 |
+
</a>
|
| 177 |
+
<a class="social-option" data-platform="linkedin">
|
| 178 |
+
<i data-feather="linkedin"></i> LinkedIn
|
| 179 |
+
</a>
|
| 180 |
+
<a class="social-option" data-platform="snapchat">
|
| 181 |
+
<i data-feather="camera"></i> Snapchat
|
| 182 |
+
</a>
|
| 183 |
+
<a class="social-option" data-platform="pinterest">
|
| 184 |
+
<i data-feather="image"></i> Pinterest
|
| 185 |
+
</a>
|
| 186 |
+
<a class="social-option" data-platform="reddit">
|
| 187 |
+
<i data-feather="message-circle"></i> Reddit
|
| 188 |
+
</a>
|
| 189 |
+
<a class="social-option" data-platform="github">
|
| 190 |
+
<i data-feather="github"></i> GitHub
|
| 191 |
+
</a>
|
| 192 |
+
</div>
|
| 193 |
+
</div>
|
|
|
|
|
|
|
| 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>
|
|
|
|
| 351 |
});
|
| 352 |
function addSocialIcon(platform, handle) {
|
| 353 |
const container = document.getElementById('socialIconsContainer');
|
| 354 |
+
|
| 355 |
+
// Create social icon element
|
| 356 |
+
const iconWrapper = document.createElement('div');
|
| 357 |
+
iconWrapper.className = 'relative group';
|
| 358 |
+
|
| 359 |
const icon = document.createElement('a');
|
| 360 |
icon.href = getSocialUrl(platform, handle);
|
| 361 |
icon.target = '_blank';
|
| 362 |
+
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';
|
| 363 |
+
icon.innerHTML = `<i data-feather="${getFeatherIconName(platform)}" class="w-5 h-5"></i>`;
|
| 364 |
+
|
| 365 |
+
// Add remove button
|
| 366 |
+
const removeBtn = document.createElement('button');
|
| 367 |
+
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';
|
| 368 |
+
removeBtn.innerHTML = '×';
|
| 369 |
+
removeBtn.onclick = function(e) {
|
| 370 |
+
e.preventDefault();
|
| 371 |
+
e.stopPropagation();
|
| 372 |
+
container.removeChild(iconWrapper);
|
| 373 |
+
};
|
| 374 |
+
|
| 375 |
+
iconWrapper.appendChild(icon);
|
| 376 |
+
iconWrapper.appendChild(removeBtn);
|
| 377 |
+
|
| 378 |
+
// Insert before the plus button
|
| 379 |
+
const addButton = document.getElementById('addSocialButton').parentNode;
|
| 380 |
+
container.insertBefore(iconWrapper, addButton);
|
| 381 |
+
|
| 382 |
feather.replace();
|
| 383 |
}
|
| 384 |
+
function getFeatherIconName(platform) {
|
|
|
|
| 385 |
const iconMap = {
|
| 386 |
instagram: 'instagram',
|
| 387 |
facebook: 'facebook',
|
|
|
|
| 411 |
};
|
| 412 |
return urls[platform] || '#';
|
| 413 |
}
|
|
|
|
| 414 |
// Update contact button href when editing
|
| 415 |
document.getElementById('contactButton').addEventListener('input', function() {
|
| 416 |
const phoneNumber = this.textContent.replace(/[^\d+]/g, '');
|
| 417 |
this.href = `tel:${phoneNumber}`;
|
| 418 |
});
|
| 419 |
|
| 420 |
+
// Enhanced social media dropdown positioning
|
| 421 |
+
const addSocialButton = document.getElementById('addSocialButton');
|
| 422 |
+
const socialDropdown = document.getElementById('socialDropdown');
|
| 423 |
+
|
| 424 |
+
addSocialButton.addEventListener('click', function(e) {
|
| 425 |
+
e.stopPropagation();
|
| 426 |
+
const rect = addSocialButton.getBoundingClientRect();
|
| 427 |
+
socialDropdown.style.display = socialDropdown.style.display === 'block' ? 'none' : 'block';
|
| 428 |
+
socialDropdown.style.bottom = '100%';
|
| 429 |
+
socialDropdown.style.top = 'auto';
|
| 430 |
+
socialDropdown.style.left = '50%';
|
| 431 |
+
socialDropdown.style.transform = 'translateX(-50%)';
|
| 432 |
+
socialDropdown.style.marginBottom = '8px';
|
| 433 |
+
});
|
| 434 |
+
// Save profile functionality
|
| 435 |
document.getElementById('saveProfile').addEventListener('click', function() {
|
| 436 |
const profileData = {
|
| 437 |
name: document.getElementById('editableName').textContent,
|
|
|
|
| 451 |
// Set content only if it's not empty or placeholder
|
| 452 |
if (profileData.name && profileData.name !== 'Tap to Add your Name') {
|
| 453 |
document.getElementById('editableName').textContent = profileData.name;
|
| 454 |
+
} else {
|
| 455 |
+
document.getElementById('editableName').textContent = 'Tap to Add your Name';
|
| 456 |
}
|
| 457 |
+
|
| 458 |
if (profileData.title && profileData.title !== 'Tap to Add your Title') {
|
| 459 |
document.getElementById('editableTitle').textContent = profileData.title;
|
| 460 |
}
|
|
|
|
| 468 |
if (profileData.image && profileData.image !== 'http://static.photos/technology/320x240/42') {
|
| 469 |
document.getElementById('profileImage').src = profileData.image;
|
| 470 |
}
|
| 471 |
+
} else {
|
| 472 |
+
// Initialize with placeholder
|
| 473 |
+
document.getElementById('editableName').textContent = 'Tap to Add your Name';
|
| 474 |
}
|
| 475 |
</script>
|
| 476 |
</body>
|