From 63904f39ee254c9014df2c158bdae39d41d8cf74 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 10 Jul 2020 16:40:02 +0200 Subject: cursors --- frontend/common/slider.component.js | 7 ++- frontend/views/page/components/tile.form.js | 82 ++++++++++++++++---------- frontend/views/page/components/tile.handle.js | 8 ++- frontend/views/page/page.css | 34 ++++++++++- static/img/hand_down.png | Bin 0 -> 2646 bytes static/img/hand_left.png | Bin 0 -> 2587 bytes static/img/hand_right.png | Bin 0 -> 2580 bytes static/img/hand_up.png | Bin 0 -> 2608 bytes 8 files changed, 98 insertions(+), 33 deletions(-) create mode 100644 static/img/hand_down.png create mode 100644 static/img/hand_left.png create mode 100644 static/img/hand_right.png create mode 100644 static/img/hand_up.png diff --git a/frontend/common/slider.component.js b/frontend/common/slider.component.js index 7e42b4d..9d96b1e 100644 --- a/frontend/common/slider.component.js +++ b/frontend/common/slider.component.js @@ -13,6 +13,7 @@ export default class Slider extends Component { this.timeout = 0 this.handleInput = this.handleInput.bind(this) this.handleRange = this.handleRange.bind(this) + this.handleKeyDown = this.handleKeyDown.bind(this) this.onChange = throttle(props.onChange, SLIDER_THROTTLE_TIME) } componentDidMount() { @@ -48,9 +49,12 @@ export default class Slider extends Component { } if (this.state.value !== new_value) { this.setState({ value: new_value }) - this.props.onChange(new_value) + this.props.onChange(this.props.name, new_value) } } + handleKeyDown(e) { + console.log(e.keyCode) + } handleRange(e){ let { value: new_value } = e.target if (this.props.type === 'int') { @@ -98,6 +102,7 @@ export default class Slider extends Component { max={max} step={step} value={text_value} + onKeyDown={this.handleKeyDown} onChange={this.handleInput} onBlur={this.handleInput} /> diff --git a/frontend/views/page/components/tile.form.js b/frontend/views/page/components/tile.form.js index eca895f..6011b0a 100644 --- a/frontend/views/page/components/tile.form.js +++ b/frontend/views/page/components/tile.form.js @@ -47,6 +47,13 @@ const TEXT_FONT_STYLES = [ 'normal', 'bold', 'italic', 'bold-italic', ].map(style => ({ name: style, label: style })) +const CURSORS = [ + { name: 'hand_up', label: 'Up', }, + { name: 'hand_down', label: 'Down', }, + { name: 'hand_left', label: 'Left', }, + { name: 'hand_right', label: 'Right', }, +] + const NO_LINK = 0 const EXTERNAL_LINK = -1 const PAGE_LIST_TOP_OPTIONS = [ @@ -64,10 +71,11 @@ const newImage = (data) => ({ is_tiled: false, tile_style: 'tile', url: "", + external_link_url: "", + cursor: 'hand_up', }, type: 'image', target_page_id: null, - external_link_url: "", ...data, }) @@ -82,20 +90,22 @@ const newText = (data) => ({ background_color: 'transparent', width: 0, height: 0, + external_link_url: "", + cursor: 'hand_up', }, type: 'text', target_page_id: null, - external_link_url: "", ...data, }) const newLink = (data) => ({ settings: { ...newPosition({ width: 100, height: 100, }), + external_link_url: "", + cursor: 'hand_up', }, type: 'link', target_page_id: null, - external_link_url: "", ...data, }) @@ -389,33 +399,6 @@ class TileForm extends Component { ) } - renderHyperlinkForm() { - const { temporaryTile } = this.props - const { pageList } = this.state - const isExternalLink = temporaryTile.target_page_id === EXTERNAL_LINK - return ( -
- +