diff options
author | Pavel Paroulek <pavel.paroulek@orange.com> | 2019-01-15 18:53:50 +0100 |
---|---|---|
committer | Pavel Paroulek <pavel.paroulek@orange.com> | 2019-01-15 18:53:50 +0100 |
commit | 58457a8de75959ae07dc09df095d72adc5965a7c (patch) | |
tree | 2c90c601d32099a42b33eeab4aa4bcf1e112767f /graphgraph-fe/src/PathBreadCrumb.js | |
parent | 81ff4563106192982aef4abcce91b78d54891247 (diff) |
Initial commit
Java dummy backend and frontend
Change-Id: I8c5528fcf8a746154e0463e065238061ddf6b877
Issue-ID: AAI-532
Signed-off-by: Pavel Paroulek <pavel.paroulek@orange.com>
Diffstat (limited to 'graphgraph-fe/src/PathBreadCrumb.js')
-rw-r--r-- | graphgraph-fe/src/PathBreadCrumb.js | 26 |
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 |