diff options
Diffstat (limited to 'src/content/dependencies/generatePageBanner.js')
-rw-r--r-- | src/content/dependencies/generatePageBanner.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/content/dependencies/generatePageBanner.js b/src/content/dependencies/generatePageBanner.js new file mode 100644 index 00000000..835140a8 --- /dev/null +++ b/src/content/dependencies/generatePageBanner.js @@ -0,0 +1,28 @@ +export default { + extraDependencies: ['html', 'to'], + + slots: { + path: { + validate: v => v.validateArrayItems(v.isString), + }, + + dimensions: { + validate: v => v.isDimensions, + }, + + alt: { + type: 'string', + }, + }, + + generate(slots, {html, to}) { + return ( + html.tag('div', {id: 'banner'}, + html.tag('img', { + src: to(...slots.path), + alt: slots.alt, + width: slots.dimensions?.[0] ?? 1100, + height: slots.dimensions?.[1] ?? 200, + }))); + }, +}; |