diff --git a/card.html b/card.html index 544a4d0..14392f8 100644 --- a/card.html +++ b/card.html @@ -196,17 +196,20 @@

Phone

// Iterate over the contacts and display contactData.contacts.forEach(contact => { - if (contact.display) { + if (contact.display && contact.value) { const item = document.createElement('div'); item.classList.add("row"); const button = document.createElement('a'); button.href = contact.link; - const icon = document.createElement('div') + // Create an img element for the icon + const icon = document.createElement('img'); icon.classList.add("icon"); + icon.src = contact.icon; + icon.alt = `${contact.contactType} icon`; button.appendChild(icon); - + const name = document.createElement('h1') name.textContent = contact.contactType; button.appendChild(name); diff --git a/cardAssets/contacts.json b/cardAssets/contacts.json index d404516..2ad2c26 100644 --- a/cardAssets/contacts.json +++ b/cardAssets/contacts.json @@ -4,37 +4,43 @@ "contactType": "Website", "display": true, "value": "DanielRedacted.net", - "link": "https://DanielRedacted.net" + "link": "https://DanielRedacted.net", + "icon": "cardAssets/icons/website.svg" }, { "contactType": "Email", "display": true, "value": "Him@DanielRedacted.net", - "link": "mailto:Him@DanielRedacted.net" + "link": "mailto:Him@DanielRedacted.net", + "icon": "cardAssets/icons/mail.svg" }, { "contactType": "Phone", "display": true, "value": "+1-000-000-0000", - "link": "tel:+10000000000" + "link": "tel:+10000000000", + "icon": "cardAssets/icons/phone.svg" }, { "contactType": "LinkedIn", "display": true, - "value": "LinkedIn Profile", - "link": "https://www.linkedin.com/in/username" + "value": "", + "link": "https://www.linkedin.com/in/username", + "icon": "" }, { "contactType": "X", "display": true, "value": "@DanielRedacted", - "link": "https://x.com/DanielRedacted" + "link": "https://x.com/DanielRedacted", + "icon": "" }, { "contactType": "Instagram", "display": true, "value": "@DanielRedacted", - "link": "https://www.instagram.com/DanielRedacted" + "link": "https://www.instagram.com/DanielRedacted", + "icon": "" } ] } diff --git a/cardAssets/icons/mail.svg b/cardAssets/icons/mail.svg new file mode 100644 index 0000000..d465a17 --- /dev/null +++ b/cardAssets/icons/mail.svg @@ -0,0 +1,20 @@ + + + + + +Mail +Created with Sketch. + + + + + + + + + \ No newline at end of file diff --git a/cardAssets/icons/phone.svg b/cardAssets/icons/phone.svg new file mode 100644 index 0000000..129d53a --- /dev/null +++ b/cardAssets/icons/phone.svg @@ -0,0 +1,6 @@ + + + +phone + + \ No newline at end of file diff --git a/cardAssets/icons/website.svg b/cardAssets/icons/website.svg new file mode 100644 index 0000000..350ddc7 --- /dev/null +++ b/cardAssets/icons/website.svg @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file