Skip to content

Commit

Permalink
added first icons
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRedacted committed Sep 17, 2024
1 parent a0c8d81 commit 55ade28
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 10 deletions.
9 changes: 6 additions & 3 deletions card.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,20 @@ <h1>Phone</h1>

// 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);
Expand Down
20 changes: 13 additions & 7 deletions cardAssets/contacts.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]",
"link": "mailto:[email protected]"
"link": "mailto:[email protected]",
"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": ""
}
]
}
Expand Down
20 changes: 20 additions & 0 deletions cardAssets/icons/mail.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions cardAssets/icons/phone.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions cardAssets/icons/website.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 55ade28

Please sign in to comment.