Skip to content

Commit

Permalink
Talk Q&A Block
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Oct 10, 2023
1 parent 8e670a7 commit d7ee928
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
27 changes: 27 additions & 0 deletions blocks/talk-qa/talk-qa.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.talk-qa {
font-size: smaller;
}

.talk-qa > div {
border-top: 2px solid var(--color-highlight-1);
margin-top: 10px;
padding-top: 5px;
}

.talk-qa > div > div:nth-child(2) {
margin-top: 10px;
margin-bottom: 20px;
padding-left: 10px;
border-left: 2px solid var(--color-medium-gray);
}

.talk-qa p {
margin-top: 3px;
margin-bottom: 3px;
line-height: 1.1rem;
}

.talk-qa p em {
font-weight: bold;
color: var(--color-medium-gray);
}
9 changes: 9 additions & 0 deletions blocks/talk-qa/talk-qa.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { append, prepend } from '../../scripts/utils/dom.js';

Check failure on line 1 in blocks/talk-qa/talk-qa.js

View workflow job for this annotation

GitHub Actions / build

'append' is defined but never used

Check failure on line 1 in blocks/talk-qa/talk-qa.js

View workflow job for this annotation

GitHub Actions / build

'append' is defined but never used

/**
* Talk Q&A
* @param {Element} block
*/
export default async function decorate(block) {
prepend(block, 'h4').textContent = 'Q&A';
}
5 changes: 5 additions & 0 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ function decorateTalkDetailPage(main) {
const talkDetailFooter = document.createElement('div');
talkDetailFooter.classList.add('talk-detail-footer');
footerSection.append(talkDetailFooter);
// move Q&A to bottom of page
const qa = main.querySelector(':scope div.talk-qa');
if (qa) {
footerSection.append(qa);
}
}
}

Expand Down
12 changes: 12 additions & 0 deletions test/blocks/talk-detail/body.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
<div>
<h1>Talk Title</h1>
<p>Talk Outline</p>
<div class="talk-qa">
<div>
<div>
<p><em>Person 1</em></p>
<p>Question?</p>
</div>
<div>
<p><em>Person 2</em></p>
<p>Answer.</p>
</div>
</div>
</div>
</div>
<div>
<p>Additional Text</p>
Expand Down

0 comments on commit d7ee928

Please sign in to comment.