Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/code/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ function getSocialLinks() {
return response.json();
})
.then(jsonData => {
console.log(jsonData)
Object.keys(jsonData).slice(1).forEach(key => {
socialLinks[key] = jsonData[key];
createSocialLink(key, jsonData[key]);
});
console.log(socialLinks)
return socialLinks;
})
.catch(error => {
Expand Down Expand Up @@ -91,8 +93,26 @@ function createImage(key) {
const socialLinksContainer = document.getElementById("socialLinks");
function createSocialLink(key, value) {
const li = document.createElement("li");
//^ New div which will contain the name of app (displayed on hover)
const div = document.createElement("div")
const img = createImage(key);
div.classList.add('hover-div')
//^ 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
Expand Down
15 changes: 15 additions & 0 deletions src/code/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,21 @@ p {
width: 100%;
height: 100%;
}
.hover-div{
/* position: absolute;
top: 105%; */
display: none;
justify-content: center;
align-items: center;
height: inherit;
width: inherit;
border-radius: inherit;
font-size: 12px;
font-weight: 700;
color: var(--accent-color);
background-color: transparent;
overflow: hidden;
}

/* ============== Info Panel ============== */

Expand Down