Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Talk Q&A Block #77

Merged
merged 3 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions blocks/talk-qa/talk-qa.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.talk-qa > div {
border-top: 2px solid var(--color-highlight-1);
margin-top: 10px;
padding-top: 5px;
font-size: smaller;
}

.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-style: normal;
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 { prepend } from '../../scripts/utils/dom.js';

/**
* 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