diff options
Diffstat (limited to 'src/content/dependencies/generateGridActionLinks.js')
-rw-r--r-- | src/content/dependencies/generateGridActionLinks.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/content/dependencies/generateGridActionLinks.js b/src/content/dependencies/generateGridActionLinks.js new file mode 100644 index 00000000..09399f17 --- /dev/null +++ b/src/content/dependencies/generateGridActionLinks.js @@ -0,0 +1,22 @@ +import {empty} from '../../util/sugar.js'; + +export default { + extraDependencies: ['html'], + + slots: { + actionLinks: {validate: v => v.sparseArrayOf(v.isHTML)}, + }, + + generate(slots, {html}) { + if (empty(slots.actionLinks)) { + return html.blank(); + } + + return ( + html.tag('div', {class: 'grid-actions'}, + slots.actionLinks + .filter(Boolean) + .map(link => link + .slot('attributes', {class: ['grid-item', 'box']})))); + }, +}; |