-
Notifications
You must be signed in to change notification settings - Fork 1
/
popup_window_example.cljs
122 lines (104 loc) · 4.04 KB
/
popup_window_example.cljs
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
(ns examples.basic.popup-window-example
(:require-macros [cljs.core.async.macros :refer [go go-loop]])
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[cljs.core.async :refer [put! chan <! alts! timeout close!]]
[sablono.core :refer-macros [html]]
[om-widgets.core :as w]))
(defn popup-window-example
[app owner]
(reify
om/IInitState
(init-state [_]
{:channel (chan)})
om/IRenderState
(render-state [this state]
(html
[:div.panel.panel-default
[:div.panel-heading "Popup window sample"]
[:div.panel-body
[:div.row
[:div.col-lg-3
(w/popover
(fn [show-window]
[:button.btn.btn-default {:id "popup-bottom-sample" :onClick #(show-window)} "▼ Popup Bottom Position"])
(fn [close-window]
(html
[:div.jumbotron
[:h3 "Click outside to close!"]]))
{:prefered-side :bottom
:popover-class ""
:for "popup-bottom-sample"})]
[:div.col-lg-3
(w/popover
(fn [show-window]
[:button.btn.btn-default {:id "popup-top-sample" :onClick #(show-window)} "▲ Popup Top Position"])
(fn [close-window]
(html
[:div.jumbotron
[:h3 "Click outside to close!"]]))
{:prefered-side :top
:popover-class ""
:for "popup-top-sample"})]
[:div.col-lg-3
(w/popover
(fn [show-window]
[:button.btn.btn-default {:id "popup-left-sample" :onClick #(show-window)} "◀ Popup Left Position"])
(fn [close-window]
(html
[:div.jumbotron
[:h3 "Click outside to close!"]]))
{:prefered-side :left
:popover-class ""
:for "popup-left-sample"})]
[:div.col-lg-3
(w/popover
(fn [show-window]
[:button.btn.btn-default {:id "popup-right-sample" :onClick #(show-window)} "► Popup Right Position"])
(fn [close-window]
(html
[:div.jumbotron
[:h3 "Click outside to close!"]]))
{:prefered-side :right
:popover-class ""
:for "popup-right-sample"})]]
[:hr]
(w/popover
(fn [show-window]
[:button.btn.btn-default {:id "popup-close-btn-sample" :onClick #(show-window)} "With close button"])
(fn [close-window]
(html
[:div.jumbotron
[:h3 "Click button to close!"]
[:button.btn.btn-danger {:onClick #(close-window)} "Close"]]))
{:prefered-side :right
:popover-class ""
:for "popup-close-btn-sample"})
[:hr]
(w/popover
"As simple link button"
(fn [_]
(html
[:div.jumbotron
[:h3 "Click outside to close!"]
(w/checkbox app :some-check {:label " Some Checkbox (Boolean)"
:title "Some tooltip"
:checked-value true
:unchecked-value false})]))
{:prefered-side :right
:label ""
:popover-class ""
:channel (:channel state)
:for "popup-close-btn-sample"})
[:hr]
(w/popover
(fn [show-window]
(dom/a #js {:id "popup-mouse-over" :onMouseOver #(show-window)} "Mouse Over!"))
(fn [close-window]
(html
[:div.popup-window-sample
[:h1 "Sample"]
[:button {:onClick #(close-window)} "Close"]]))
{:prefered-side :bottom
:popover-class ""
:for "popup-mouse-over"})]]))))