sectionView = (config, cells, sections, sectionKey, {
hashPrefix = ''
} = {}) => {
const suffix = sectionKey.split("/").pop();
const subtitle = config.menuSegmentLabels?.[suffix] || suffix;
const orderedQuestions = sections.get(sectionKey).map(layoutRow => {
let cell = cells.get(layoutRow.id)
if (cell === undefined) {
cell = md`<mark>Error question not-found for ${layoutRow.id}</mark>`
}
cell.id = layoutRow.id
return cell;
});
const pageKeys = paginationKeys(sections, sectionKey);
const paginationEl = pagination({...pageKeys, hashPrefix});
return view`<section id="${hashPrefix}${sectionKey}"
data-survey-section="${hashPrefix}${sectionKey}"
class="pa2 pa4-ns pl5-l"
style="background: #f4f4f4 url(${imageFor(sectionKey)});
background-size: cover;
background-attachment: fixed;
background-position: center 4rem;
background-repeat: no-repeat;
display: ${location.hash === `#${hashPrefix}${sectionKey}`? 'block' : 'none'};
">
<div class="bg-white shadow-2 f4 measure-wide mr-auto">
<div class="ph4 pt3 pb0 f5 lh-copy">
<!-- <h1 class="mt0 mb4">${subtitle}</h1> -->
<div class="db">
${['...', orderedQuestions.reduce((acc, q) => Object.defineProperty(acc, q.id, {value: q, enumerable: true}), {})]}
</div>
</div>
<div class="sticky bottom-0">
<div class="ph4 pv3 bt b--black-10 bg-near-white">
${paginationEl}
</div>
</div>
</div>
</section>`
}