Skip to content

Commit

Permalink
Created a Dave component with green title and red subtitle.
Browse files Browse the repository at this point in the history
  • Loading branch information
davenichols-DHLS committed Dec 2, 2024
1 parent b59e8bc commit 1ff16ad
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions blocks/dave/dave.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.dave strong {
color: green;
font-size: 2rem;
font-weight: bold;
border-bottom: 2px solid green;
}

.dave i {
color: red;
font-size: 1.5rem;
font-style: italic;
}
13 changes: 13 additions & 0 deletions blocks/dave/dave.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default function decorate(block) {
const quoteDiv = block.querySelector('div:last-of-type');

Check failure on line 2 in blocks/dave/dave.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 2 spaces but found 0
const dave = document.createElement('dave');

Check failure on line 3 in blocks/dave/dave.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 2 spaces but found 0
dave.innerHTML = `<strong>${quoteDiv.innerHTML}</strong>`;

Check failure on line 4 in blocks/dave/dave.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 2 spaces but found 0
quoteDiv.replaceWith(dave);

Check failure on line 5 in blocks/dave/dave.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 2 spaces but found 0

const authorDiv = block.querySelector('div:nth-child(2)');

Check failure on line 7 in blocks/dave/dave.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 2 spaces but found 0
if (authorDiv) {

Check failure on line 8 in blocks/dave/dave.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 2 spaces but found 0
const author = document.createElement('p');
author.innerHTML = `<i>${authorDiv.innerHTML}</i>`;
authorDiv.replaceWith(author);
}

Check failure on line 12 in blocks/dave/dave.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 2 spaces but found 0
}

0 comments on commit 1ff16ad

Please sign in to comment.