1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
import React from 'react'
import {
TextInput,
Select,
} from 'app/common'
import {
CURSORS,
NO_LINK, EXTERNAL_LINK,
NO_POPUP, OPEN_POPUP_LINK, CLOSE_POPUP_LINK, TOGGLE_POPUP_LINK
} from './tile.constants'
import { dispatch } from 'app/store'
import { toggleCursorList } from 'app/views/page/page.actions'
export default function TileHyperlinkForm({ tile, pageList, popupList, cursors, parent }) {
const isExternalLink = tile.target_page_id === EXTERNAL_LINK
// const isPopupLink = (
// tile.target_page_id === OPEN_POPUP_LINK ||
// tile.target_page_id === CLOSE_POPUP_LINK
// )
let cursor
// console.log(tile.settings.cursor, tile.settings.custom_cursor_id)
if (tile.settings.cursor === 'custom' && tile.settings.custom_cursor_id) {
cursor = cursors[tile.settings.custom_cursor_id]
// console.log(cursor)
}
return (
<div>
<div className={'row selects'}>
<Select
title=''
name='target_page_id'
selected={tile.target_page_id || NO_LINK}
options={pageList}
onChange={parent.handleSelect}
/>
<Select
title=''
name='cursor'
selected={tile.settings.cursor}
options={CURSORS}
defaultOption="Cursor"
onChange={parent.handleSettingsSelect}
/>
</div>
{cursor && (
<img src={cursor.url} className="sampleCursor" onClick={() => toggleCursorList(true)(dispatch)} />
)}
{isExternalLink && (
<div>
<TextInput
title=""
placeholder='http://'
name="external_link_url"
data={tile.settings}
onChange={parent.handleSettingsChange}
autoComplete="off"
/>
</div>
)}
{(tile.target_page_id === OPEN_POPUP_LINK || tile.target_page_id === CLOSE_POPUP_LINK || tile.target_page_id === TOGGLE_POPUP_LINK) && (
<div className='row single'>
<Select
title="Popup"
name='target_popup'
selected={tile.settings.target_popup || NO_POPUP}
options={popupList}
onChange={parent.handleSettingsSelect}
/>
</div>
)}
</div>
)
}
|