Skip to content

Commit

Permalink
feat: blockquote block
Browse files Browse the repository at this point in the history
  • Loading branch information
fkakatie committed Jul 25, 2022
1 parent 8f26731 commit 09dd9d1
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 17 deletions.
16 changes: 16 additions & 0 deletions blocks/blockquote/blockquote.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
main .blockquote blockquote {
margin-left: 0;
margin-right: 0;
font-size: var(--body-font-size-xs);
}

main .blockquote blockquote q {
quotes: "“" "”" "‘" "’" ;
color: var(--color-blue);
}

@media (min-width: 700px) {
main .blockquote blockquote {
font-size: var(--body-font-size-s);
}
}
17 changes: 17 additions & 0 deletions blocks/blockquote/blockquote.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default async function decorate(block) {
const quotes = block.querySelectorAll('h2');
const ps = block.querySelectorAll('p');
block.innerHTML = '';

const wrapper = document.createElement('blockquote');
quotes.forEach((quote) => {
const q = document.createElement('q');
q.innerHTML = quote.innerHTML;
wrapper.append(q);
});
ps.forEach((p) => {
wrapper.append(p);
});

block.append(wrapper);
}
17 changes: 0 additions & 17 deletions styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -248,23 +248,6 @@ main pre {
white-space: pre;
}

main blockquote {
font-style: italic;
margin: 3rem;
text-indent: -1rem;
hanging-punctuation: first;
}

main blockquote p::before {
content: "“";
line-height: 0;
}

main blockquote p::after {
content: "”";
line-height: 0;
}

hr {
margin-top: 1.5em;
margin-bottom: 1.5em;
Expand Down

0 comments on commit 09dd9d1

Please sign in to comment.