MidouEmail commited on
Commit
418e913
·
verified ·
1 Parent(s): 9b6d1ca

every section with text input have same problem, its hiding text after user tap to add his text, so user dont see nothing, and second issue that there is a border who appear when tap to add text, and this make it not nice and looking ugly, so the text color and backgroung and the borderless design must remain the same,

Browse files
Files changed (1) hide show
  1. index.html +109 -7
index.html CHANGED
@@ -30,12 +30,16 @@
30
  cursor: pointer;
31
  transition: all 0.3s ease;
32
  }
 
 
 
 
 
33
  .editable:hover {
34
- background: rgba(255, 255, 255, 0.1);
35
  border-radius: 4px;
36
- padding: 2px 4px;
37
  }
38
- .social-dropdown {
39
  display: none;
40
  position: absolute;
41
  background: rgba(0, 0, 0, 0.9);
@@ -93,15 +97,13 @@
93
  <h1 id="editableName" class="text-3xl font-bold mb-3 gradient-text editable" contenteditable="true">
94
  Tap to Add your Name
95
  </h1>
96
-
97
  <!-- Contact Button -->
98
  <div class="relative mb-4 w-3/5 mx-auto">
99
- <a id="contactButton" href="tel:" class="px-6 py-3 border border-indigo-500 rounded-full hover:bg-indigo-900/30 transition text-base w-full block editable" contenteditable="true">
100
  Tap to Add Phone Number
101
  </a>
102
  </div>
103
-
104
- <!-- Editable Title -->
105
  <p id="editableTitle" class="text-xl text-gray-300 mb-4 editable" contenteditable="true">
106
  Tap to Add your Title
107
  </p>
@@ -172,6 +174,106 @@
172
  });
173
  });
174
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  </script>
176
  </body>
177
  </html>
 
30
  cursor: pointer;
31
  transition: all 0.3s ease;
32
  }
33
+ .editable:focus {
34
+ outline: none;
35
+ background: transparent;
36
+ border-radius: 4px;
37
+ }
38
  .editable:hover {
39
+ background: rgba(255, 255, 255, 0.05);
40
  border-radius: 4px;
 
41
  }
42
+ .social-dropdown {
43
  display: none;
44
  position: absolute;
45
  background: rgba(0, 0, 0, 0.9);
 
97
  <h1 id="editableName" class="text-3xl font-bold mb-3 gradient-text editable" contenteditable="true">
98
  Tap to Add your Name
99
  </h1>
 
100
  <!-- Contact Button -->
101
  <div class="relative mb-4 w-3/5 mx-auto">
102
+ <a id="contactButton" href="tel:" class="px-4 py-2 border border-indigo-500 rounded-full hover:bg-indigo-900/30 transition text-sm w-full block editable" contenteditable="true">
103
  Tap to Add Phone Number
104
  </a>
105
  </div>
106
+ <!-- Editable Title -->
 
107
  <p id="editableTitle" class="text-xl text-gray-300 mb-4 editable" contenteditable="true">
108
  Tap to Add your Title
109
  </p>
 
174
  });
175
  });
176
  });
177
+
178
+ // Image upload functionality
179
+ document.getElementById('imageUpload').addEventListener('change', function(e) {
180
+ const file = e.target.files[0];
181
+ if (file) {
182
+ const reader = new FileReader();
183
+ reader.onload = function(e) {
184
+ document.getElementById('profileImage').src = e.target.result;
185
+ }
186
+ reader.readAsDataURL(file);
187
+ }
188
+ });
189
+
190
+ // Make image container clickable
191
+ document.querySelector('.image-upload-container').addEventListener('click', function() {
192
+ document.getElementById('imageUpload').click();
193
+ });
194
+
195
+ // Social media dropdown functionality
196
+ document.getElementById('addSocialButton').addEventListener('click', function() {
197
+ const dropdown = document.getElementById('socialDropdown');
198
+ dropdown.style.display = dropdown.style.display === 'block' ? 'none' : 'block';
199
+ });
200
+
201
+ // Close dropdown when clicking outside
202
+ document.addEventListener('click', function(e) {
203
+ if (!e.target.closest('#socialDropdown') && !e.target.closest('#addSocialButton')) {
204
+ document.getElementById('socialDropdown').style.display = 'none';
205
+ }
206
+ });
207
+
208
+ // Social media platform selection
209
+ document.querySelectorAll('.social-option').forEach(option => {
210
+ option.addEventListener('click', function() {
211
+ const platform = this.getAttribute('data-platform');
212
+ const handle = prompt(`Enter your ${platform} handle:`);
213
+ if (handle) {
214
+ addSocialIcon(platform, handle);
215
+ }
216
+ document.getElementById('socialDropdown').style.display = 'none';
217
+ });
218
+ });
219
+
220
+ function addSocialIcon(platform, handle) {
221
+ const container = document.getElementById('socialIconsContainer');
222
+ const icon = document.createElement('a');
223
+ icon.href = getSocialUrl(platform, handle);
224
+ icon.target = '_blank';
225
+ icon.className = 'text-gray-400 hover:text-white transition';
226
+ icon.innerHTML = `<i data-feather="${platform}"></i>`;
227
+ container.appendChild(icon);
228
+ feather.replace();
229
+ }
230
+
231
+ function getSocialUrl(platform, handle) {
232
+ const urls = {
233
+ instagram: `https://instagram.com/${handle}`,
234
+ facebook: `https://facebook.com/${handle}`,
235
+ twitter: `https://twitter.com/${handle}`,
236
+ tiktok: `https://tiktok.com/@${handle}`,
237
+ youtube: `https://youtube.com/@${handle}`,
238
+ linkedin: `https://linkedin.com/in/${handle}`,
239
+ snapchat: `https://snapchat.com/add/${handle}`,
240
+ pinterest: `https://pinterest.com/${handle}`,
241
+ reddit: `https://reddit.com/user/${handle}`,
242
+ github: `https://github.com/${handle}`
243
+ };
244
+ return urls[platform] || '#';
245
+ }
246
+
247
+ // Update contact button href when editing
248
+ document.getElementById('contactButton').addEventListener('input', function() {
249
+ const phoneNumber = this.textContent.replace(/[^\d+]/g, '');
250
+ this.href = `tel:${phoneNumber}`;
251
+ });
252
+
253
+ // Save profile functionality
254
+ document.getElementById('saveProfile').addEventListener('click', function() {
255
+ const profileData = {
256
+ name: document.getElementById('editableName').textContent,
257
+ title: document.getElementById('editableTitle').textContent,
258
+ description: document.getElementById('editableDescription').textContent,
259
+ phone: document.getElementById('contactButton').textContent,
260
+ image: document.getElementById('profileImage').src
261
+ };
262
+ localStorage.setItem('profileData', JSON.stringify(profileData));
263
+ alert('Profile saved successfully!');
264
+ });
265
+
266
+ // Load saved profile
267
+ const savedProfile = localStorage.getItem('profileData');
268
+ if (savedProfile) {
269
+ const profileData = JSON.parse(savedProfile);
270
+ document.getElementById('editableName').textContent = profileData.name;
271
+ document.getElementById('editableTitle').textContent = profileData.title;
272
+ document.getElementById('editableDescription').textContent = profileData.description;
273
+ document.getElementById('contactButton').textContent = profileData.phone;
274
+ document.getElementById('contactButton').href = `tel:${profileData.phone.replace(/[^\d+]/g, '')}`;
275
+ document.getElementById('profileImage').src = profileData.image;
276
+ }
277
  </script>
278
  </body>
279
  </html>