diff options
Diffstat (limited to 'src/content/util')
-rw-r--r-- | src/content/util/getChronologyRelations.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/content/util/getChronologyRelations.js b/src/content/util/getChronologyRelations.js new file mode 100644 index 00000000..cdfdef39 --- /dev/null +++ b/src/content/util/getChronologyRelations.js @@ -0,0 +1,19 @@ +export default function getChronologyRelations(thing, { + contributions, + linkArtist, + linkThing, + getThings, +}) { + return contributions.map(({who}) => { + const things = getThings(who); + const index = things.indexOf(thing); + const previous = things[index - 1]; + const next = things[index + 1]; + return { + index: index + 1, + artistLink: linkArtist(who), + previousLink: previous ? linkThing(previous) : null, + nextLink: next ? linkThing(next) : null, + }; + }); +} |