diff options
Diffstat (limited to 'src/content/dependencies/generateStickyHeadingContainer.js')
-rw-r--r-- | src/content/dependencies/generateStickyHeadingContainer.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/content/dependencies/generateStickyHeadingContainer.js b/src/content/dependencies/generateStickyHeadingContainer.js new file mode 100644 index 00000000..5ea10765 --- /dev/null +++ b/src/content/dependencies/generateStickyHeadingContainer.js @@ -0,0 +1,33 @@ +export default { + extraDependencies: ['html'], + + slots: { + title: {type: 'html'}, + cover: {type: 'html'}, + }, + + generate(slots, {html}) { + const hasCover = !html.isBlank(slots.cover); + + return html.tag('div', + { + class: [ + 'content-sticky-heading-container', + hasCover && 'has-cover', + ], + }, + [ + html.tag('div', {class: 'content-sticky-heading-row'}, [ + html.tag('h1', slots.title), + + hasCover && + html.tag('div', {class: 'content-sticky-heading-cover-container'}, + html.tag('div', {class: 'content-sticky-heading-cover'}, + slots.cover.slot('mode', 'thumbnail'))), + ]), + + html.tag('div', {class: 'content-sticky-subheading-row'}, + html.tag('h2', {class: 'content-sticky-subheading'})), + ]); + }, +}; |