diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-09-26 14:56:02 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-09-26 14:56:02 +0200 |
| commit | a17b76ac75f506f5da6fe8adf9c36632b60d4226 (patch) | |
| tree | abb0af0c4409b830dea2ef808c146223ee973933 /frontend/views/graph/components/page.handle.js | |
| parent | 2231a6e1c05b07bb7ec5906716aedec93d02429c (diff) | |
refactor to use app-rooted js imports
Diffstat (limited to 'frontend/views/graph/components/page.handle.js')
| -rw-r--r-- | frontend/views/graph/components/page.handle.js | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/frontend/views/graph/components/page.handle.js b/frontend/views/graph/components/page.handle.js deleted file mode 100644 index 7093399..0000000 --- a/frontend/views/graph/components/page.handle.js +++ /dev/null @@ -1,59 +0,0 @@ -import React, { Component } from 'react' -import { Link } from 'react-router-dom' - -import { history } from '../../../store' - -export default class PageHandle extends Component { - constructor(props){ - super(props) - this.ref = React.createRef() - } - componentDidMount(){ - this.measure() - } - componentDidUpdate(prevProps){ - if (this.props.page.title !== prevProps.page.title) { - this.measure() - } - } - measure() { - const { offsetWidth: width, offsetHeight: height } = this.ref.current - const { id } = this.props.page - // console.log(id, width, height) - this.props.onMeasure({ id, width, height }) - } - render() { - const { graph, page, bounds, box, onMouseDown, onMouseEnter, onMouseLeave } = this.props - let style; - if (box) { - style = { - top: (bounds.height) * box.y, - left: (bounds.width) * box.x, - } - } else { - style = { - top: (bounds.height) * Math.min(page.settings.y, 0.95), - left: (bounds.width) * Math.min(page.settings.x, 0.95), - } - } - const className = (graph.home_page_id === page.id) - ? 'handle homepage' - : 'handle' - const url = '/' + graph.path + '/' + page.path - // console.log(style) - return ( - <div - className={className} - ref={this.ref} - onMouseDown={onMouseDown} - onMouseEnter={onMouseEnter} - onMouseLeave={onMouseLeave} - onDoubleClick={() => history.push(url)} - style={style} - > - {page.path} - <Link to={url}>{'>'}</Link> - </div> - ) - } -} |
