lotus/lotuspond/front/src/BlockLink.js

27 lines
753 B
JavaScript
Raw Normal View History

2019-07-25 17:06:10 +00:00
import React from 'react';
import Block from "./Block";
export class BlockLinks extends React.Component {
render() {
2019-08-09 16:11:46 +00:00
return this.props.cids.map(c => <BlockLink key={c} conn={this.props.conn} cid={c} mountWindow={this.props.mountWindow}/>)
2019-07-25 17:06:10 +00:00
}
}
class BlockLink extends React.Component {
constructor(props) {
super(props)
this.openBlockViewer = this.openBlockViewer.bind(this)
}
openBlockViewer() {
this.props.mountWindow((onClose) => <Block cid={this.props.cid} conn={this.props.conn} onClose={onClose} mountWindow={this.props.mountWindow}/>)
}
render() {
return <a href="#" onClick={this.openBlockViewer}><abbr title={this.props.cid['/']}>{this.props.cid['/'].substr(-8)}</abbr></a>
}
}
export default BlockLink