Skip to content

Instantly share code, notes, and snippets.

@bwaidelich
Created January 15, 2019 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwaidelich/c6bced97eb583b3853e7e879009cd7b6 to your computer and use it in GitHub Desktop.
Save bwaidelich/c6bced97eb583b3853e7e879009cd7b6 to your computer and use it in GitHub Desktop.
Atomic Fusion: Content with TOC
prototype(Some.Package:Component.ContentWithToc) < prototype(Neos.Fusion:Component) {
blocks = Neos.Fusion:RawArray
renderer = afx`
<nav>
<ul>
<Neos.Fusion:Collection collection={props.blocks} itemName="block" @children="itemRenderer">
<li>
<a href={'#c-' + iterator.cycle}>{block.label}</a>
</li>
</Neos.Fusion:Collection>
</ul>
</nav>
<Neos.Fusion:Collection collection={props.blocks} itemName="block" @children="itemRenderer">
<div id={'#c-' + iterator.cycle}>
{block.content}
</div>
</Neos.Fusion:Collection>
`
}
prototype(Some.Package:Component.ContentWithToc.Block) < prototype(Neos.Fusion:RawArray) {
label = ''
content = ''
}
root = Some.Package:Component.ContentWithToc {
blocks {
0 = Some.Package:Component.ContentWithToc.Block {
label = 'Content #1'
content = 'Lorem ipsum dolor #1'
}
1 = Some.Package:Component.ContentWithToc.Block {
label = 'Content #2'
content = 'Lorem ipsum dolor #2'
}
2 = Some.Package:Component.ContentWithToc.Block {
label = 'Content #3'
content = 'Lorem ipsum dolor #3'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment