Skip to content

Commit

Permalink
Update different style options for two two templates
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmills committed Aug 15, 2024
1 parent beb7823 commit a1641b2
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
advertElement.appendChild(title);

const description = document.createElement('p');
description.innerText = advert.description;
// Check if the description is an array and join with new lines if it is
if (Array.isArray(advert.description)) {
description.innerText = advert.description.join('\n');
} else {
description.innerText = advert.description;
}
advertElement.appendChild(description);

const button = document.createElement('a');
Expand All @@ -53,6 +58,7 @@
const style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = `
/* Common styles for all templates */
#${containerId} .advert {
border: 1px solid #ccc;
padding: 16px;
Expand Down Expand Up @@ -83,6 +89,22 @@
#${containerId} .advert-button:hover {
background-color: #0056b3;
}
/* Styles for template-simple */
#${containerId}.template-simple .advert {
margin-bottom: 16px;
display: block;
}
/* Styles for template-card */
#${containerId}.template-card {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 16px;
}
#${containerId}.template-card .advert {
margin: 0;
}
`;
document.head.appendChild(style);
}
Expand Down

0 comments on commit a1641b2

Please sign in to comment.