aboutsummaryrefslogtreecommitdiffstats
path: root/graphgraph-fe/src/PathBreadCrumb.js
diff options
context:
space:
mode:
Diffstat (limited to 'graphgraph-fe/src/PathBreadCrumb.js')
-rw-r--r--graphgraph-fe/src/PathBreadCrumb.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/graphgraph-fe/src/PathBreadCrumb.js b/graphgraph-fe/src/PathBreadCrumb.js
new file mode 100644
index 0000000..a2c508a
--- /dev/null
+++ b/graphgraph-fe/src/PathBreadCrumb.js
@@ -0,0 +1,26 @@
+import _ from 'underscore'
+import React from 'react'
+import { Breadcrumb } from 'react-bootstrap'
+
+class PathBreadCrumb extends React.Component {
+ constructor (props, context) {
+ super(props, context)
+ this.pathSelected = this.pathSelected.bind(this)
+ }
+
+ pathSelected (evt) {
+ evt.preventDefault()
+ // the data is only piggyback riding on the "target" property .. not nice but works
+ this.props.pathCallback(this.props.index, evt.target.getAttribute('target'))
+ }
+
+ render () {
+ var path = this.props.path
+ var callback = this.pathSelected
+ var items = _.map(path, (item, i) => <Breadcrumb.Item key={i} target={item.id} onClick={callback}> {item.id} </Breadcrumb.Item>)
+
+ return (<Breadcrumb>{items}</Breadcrumb>)
+ }
+}
+
+export default PathBreadCrumb