diff --git a/src/code/index.html b/src/code/index.html
index 2336d70..174b719 100644
--- a/src/code/index.html
+++ b/src/code/index.html
@@ -26,6 +26,9 @@
diff --git a/src/code/index.js b/src/code/index.js
index eec9bc0..a71fbec 100644
--- a/src/code/index.js
+++ b/src/code/index.js
@@ -62,7 +62,7 @@ function getSocialLinks() {
.then(jsonData => {
Object.keys(jsonData).slice(1).forEach(key => {
socialLinks[key] = jsonData[key];
- createSocialLink(key, jsonData[key]);
+ createSocialLink(key);
});
return socialLinks;
})
@@ -78,6 +78,15 @@ const socialLinks = getSocialLinks();
// ============== Home ==============
function showCopyMessage(key) {
console.log(`Copied ${key} to clipboard!`);
+ const copyConfirm = document.getElementById('copyConfirm');
+const copyText = copyConfirm.querySelector('.copy-text');
+copyText.textContent = `✅${key} profile copied.`;
+copyConfirm.style.display = 'flex';
+
+setTimeout(() => {
+ copyConfirm.style.display = 'none';
+}, 3000);
+
};
function createImage(key) {
@@ -89,13 +98,31 @@ function createImage(key) {
}
const socialLinksContainer = document.getElementById("socialLinks");
-function createSocialLink(key, value) {
+function createSocialLink(key) {
const li = document.createElement("li");
+ // Here this will be a div which will come over the top of the icon and it will show the name of the app
+ const div = document.createElement("div")
const img = createImage(key);
+ div.classList.add('div-hover-effect')
+ //^ making the string short if it overflows (based upon its length)
+ if (key.length>8){
+ div.textContent = `${key.substr(0,8)+"..."}`
+ }else{
+ div.textContent = key
+ }
+ li.addEventListener("mouseenter",()=>{
+ img.style.display = 'none'
+ div.style.display = 'flex'
+ })
+ li.addEventListener('mouseleave',()=>{
+ img.style.display = 'block'
+ div.style.display = 'none'
+ })
img.onload = () => {
+ li.appendChild(div)
li.appendChild(img);
li.addEventListener("click", () => {
- navigator.clipboard.writeText(value); // Copy the value to clipboard
+ navigator.clipboard.writeText(socialLinks[key]); // Copy the value to clipboard
showCopyMessage(key);
});
socialLinksContainer.appendChild(li);
@@ -504,4 +531,38 @@ function addDnDHandlers(elem) {
const saveBtn = document.getElementById("save-btn");
saveBtn.addEventListener("click", () => {
const links = Array.from(document.querySelectorAll(".link-box input"));
-});
\ No newline at end of file
+});
+
+function addLinkBoxOnSave() {
+ const linkInputBox = document.querySelectorAll(".link-box input");
+ if (linkInputBox) {
+ linkInputBox.forEach((linkInput) => {
+ let inputURL = linkInput.value;
+ if (isValidURL(inputURL)) {
+ //if the link box already exists in home then update the existing one, else create a new box
+ const res = getSocialName(inputURL);
+ const key = res.key;
+ const value = inputURL;
+ let linkExists = false;
+ const homeSocials = document.querySelectorAll(".social-logo");
+ homeSocials.forEach((social) => {
+ if (key == social.alt) {
+ socialLinks[key] = value;
+ console.log(socialLinks);
+ linkExists = true;
+ return;
+ }
+ });
+ //else create a link box on home page
+ if (!linkExists) {
+ socialLinks[key] = value;
+ createSocialLink(key);
+ }
+ //if not a valid URL
+ } else {
+ console.log("invalid URL");
+ }
+ });
+ }
+ }
+ saveBtn.addEventListener("click", addLinkBoxOnSave);
\ No newline at end of file
diff --git a/src/code/style.css b/src/code/style.css
index 1fd6433..eb6dd1b 100644
--- a/src/code/style.css
+++ b/src/code/style.css
@@ -6,21 +6,21 @@
box-sizing: border-box;
/* font-family: "Source Sans 3", sans-serif; */
font-family: "Raleway", sans-serif;
- transition: all 300ms ease;
+ transition: all 400ms ease;
list-style-type: none;
}
:root {
- --primary-color: #7029ff;
- --secondary-color: #b58fff;
- --accent-color: #d0beff;
- --text-color: #eeeeee;
+ --primary-color: #a47df2;
+ --secondary-color: #c3b0e8;
+ --accent-color: #ab98d8;
+ --text-color: #faf1f1;
--text-color-2: #242327;
}
body {
- width: 500px;
- height: 450px;
+ width: 600px;
+ height: 600px;
font-family: Arial, Helvetica, sans-serif;
text-align: center;
scroll-behavior: smooth;
@@ -77,8 +77,8 @@ nav li button {
}
nav li button:active {
- transform: scale(0.9);
- transition-duration: 100ms;
+ transform: scale(0.7);
+ transition-duration: 120ms;
}
#info-btn {
@@ -184,6 +184,21 @@ p {
height: 100%;
}
+.div-hover-effect{
+ /* position: absolute;
+ top: 105%; */
+ display: none;
+ justify-content: center;
+ align-items: center;
+ height: inherit;
+ width: inherit;
+ border-radius: inherit;
+ font-size: 11px;
+ font-weight: 700;
+ color: white;
+ background-color: transparent;
+ overflow: hidden;
+}
/* ============== Info Panel ============== */
#info {
@@ -312,7 +327,7 @@ table td {
#images {
display: flex;
- gap: 1.5rem;
+ gap: 1.7rem;
}
#images img {
@@ -345,7 +360,7 @@ table td {
font-size: 0.9rem;
outline: none;
border: none;
- background-color: var(--accent-color);
+ background-color: white;
color: var(--primary-color);
font-weight: 600;
text-align: center;
@@ -542,3 +557,24 @@ table td {
transform: scale(0.9);
transition-duration: 100ms;
}
+
+.copy-confirm {
+ display: none;
+ position: absolute;
+ bottom: 20px;
+ left: 50%;
+ transform: translateX(-50%);
+ background-color: var(--primary-color);
+ color: var(--text-color);
+ padding: 0.5rem 1rem;
+ border-radius: 5px;
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
+ font-size: 1rem;
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+}
+
+.copy-confirm .check {
+ font-size: 1.2rem;
+}
\ No newline at end of file