Skip to content

Commit 2554dae

Browse files
committed
Allow titles/subtitles defined by a callback function
1 parent c3fe0ac commit 2554dae

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/node-renderer-default.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,18 @@ const NodeRendererDefault = ({
104104
(node.subtitle ? ` ${styles.rowTitleWithSubtitle}` : '')
105105
}
106106
>
107-
{node.title}
107+
{typeof node.title === 'function' ?
108+
node.title({node, path, treeIndex }) :
109+
node.title
110+
}
108111
</span>
109112

110113
{node.subtitle &&
111114
<span className={styles.rowSubtitle}>
112-
{node.subtitle}
115+
{typeof node.subtitle === 'function' ?
116+
node.subtitle({node, path, treeIndex }) :
117+
node.subtitle
118+
}
113119
</span>
114120
}
115121
</div>

0 commit comments

Comments
 (0)