Skip to content

Commit

Permalink
examples: code & filter
Browse files Browse the repository at this point in the history
  • Loading branch information
awb99 committed Apr 22, 2021
1 parent 2416092 commit 6633d48
Show file tree
Hide file tree
Showing 28 changed files with 285 additions and 260 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
"vega-lite": "4.17.0"
},
"devDependencies": {},
"_comment": "generated by webly on 2021-04-22 17:50:44"
"_comment": "generated by webly on 2021-04-22 20:22:48"
}
36 changes: 13 additions & 23 deletions profiles/demo/src/demo/app.cljs
Original file line number Diff line number Diff line change
@@ -1,32 +1,22 @@
(ns demo.app
(:require
[webly.user.app.app :refer [webly-run!]]
[demo.routes :refer [routes-api routes-app]]

[webly.web.handler :refer [reagent-page]]
[pinkgorilla.ui.default-renderer] ; add ui renderer definitions

; examples
[example.pinkie]
[example.controls]
; from renderable-ui
[example.gtable]
; js based enderer
[example.highchart]
[example.json]
[example.vega]
[example.math]
; reagent based renderer
[example.leaflet]
[example.sparklines]
[example.player]
[example.aggrid]
[example.clock]
[example.gridlayout]
[example.pydoc]
[example.core :refer [example-component]]
; demo
[demo.views]
[demo.events]
[demo.routes :refer [routes-api routes-app]]
[demo.events] ; side-effects
))

(defmethod reagent-page :demo/main [& args]
[example-component])

(defmethod reagent-page :demo/viz [& args]
(let [nsf (namespace :viz/all)]
(println "nsf: " nsf)
[example-component nsf]))


(defn ^:export start []
(webly-run! routes-api routes-app))
28 changes: 0 additions & 28 deletions profiles/demo/src/demo/example.cljs

This file was deleted.

4 changes: 3 additions & 1 deletion profiles/demo/src/demo/routes.cljc
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
(ns demo.routes)

(def routes-app
{"" :demo/main})
{"" :demo/main
"viz" :demo/viz
})

(def routes-api
{})
8 changes: 0 additions & 8 deletions profiles/demo/src/example/clock.cljs

This file was deleted.

10 changes: 0 additions & 10 deletions profiles/demo/src/example/gtable.cljs

This file was deleted.

10 changes: 0 additions & 10 deletions profiles/demo/src/example/player.cljs

This file was deleted.

40 changes: 0 additions & 40 deletions profiles/demo/src/example/pydoc.cljs

This file was deleted.

25 changes: 0 additions & 25 deletions profiles/demo/src/example/sparklines.cljs

This file was deleted.

37 changes: 17 additions & 20 deletions profiles/demo/src/example/aggrid.cljs → src/example/aggrid.cljs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(ns example.aggrid
(:require
[thi.ng.strf.core :as f]
[demo.example :as example]
[example.example :as example]
[pinkgorilla.ui.data.aggrid :refer [aggrid]]))

(def columnDefs [{:headerName "Make" :field "make"}
Expand Down Expand Up @@ -62,26 +62,23 @@
{:headerName "Vol-F" :field "vol-factor" :width 50 :valueFormatter currency-formatter :sortable false :filter false}
{:headerName "Comment" :field "s" :width 300 :sortable false :filter false}])


(example/add
"aggrid"
[:div ; .aggrid-demo ; .aggrid-container

[:h1 "simple demo:"]
[:div {:style {:height "150px"
:width "600px"}}
[aggrid {:columnDefs columnDefs
:rowData rowData}]]
:viz/aggrid
[:div {:style {:height "150px"
:width "600px"}}
[:p/aggrid {:columnDefs columnDefs
:rowData rowData}]])

[:h1 "complex demo:"]
[:div {:className "ag-theme-balham"
:style {; either both pixels, or both percentage.
:height "400px"
:width "600px"
(example/add
:viz/aggrid
[:div {:className "ag-theme-balham"
:style {; either both pixels, or both percentage.
:height "400px"
:width "600px"
;:height "100%"
;:width "100%"
:color "blue"}}
[aggrid {:columnDefs rateCols
:rowData rates
:pagination true
:paginationAutoPageSize true}]]])
:color "blue"}}
[:p/aggrid {:columnDefs rateCols
:rowData rates
:pagination true
:paginationAutoPageSize true}]])
7 changes: 7 additions & 0 deletions src/example/clock.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(ns example.clock
(:require [example.example :as example]))

(example/add
:gorilla/clock
[:div ; .clock-demo
[:p/clock]])
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
[goog.object :as g]
[reagent.core :as r]
[pinkie.pinkie :refer [tag-inject]]
[demo.example :as example]))

[example.example :as example]))

(example/add
"tab"
:layout/tab
[:div
[:ul {:class "list-reset flex border-b"}
[:li {:class "-mb-px mr-1"}
Expand All @@ -23,7 +22,6 @@
(defn debug [v]
(g/set js/window "x" v))


(def demo
(let [languages ["javascript" "ruby" "clojure" "clojurescript" "ocaml" "scheme" "elixir" "c#" "R" "python"]
state (r/atom {:name "Someone Special"
Expand Down Expand Up @@ -77,10 +75,10 @@

[:p/panel {:title "display only controls"}
[:h2 "Popover"]
[:p/popover {:color "orange"
[:p/popover {:color "yellow"
:placement "left"
:button-text "orange-l"}
[:p/tooltip {:color "orange"
:button-text "yellow-l"}
[:p/tooltip {:color "red"
:title "oranges"
:content "Lets make orange juice"}]]
[:p/popover {:color "green"
Expand All @@ -100,5 +98,6 @@
(tag-inject demo))

(example/add
"controls" ;[demo]
:layout/controls
;[demo]
[demo2])
43 changes: 26 additions & 17 deletions profiles/demo/src/demo/views.cljs → src/example/core.cljs
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
(ns demo.views
(ns example.core
(:require
[webly.web.handler :refer [reagent-page]]
;[pinkgorilla.ui.ui.dialog :refer [modal-container]]

[pinkgorilla.ui.layout.sidebar :refer [sidebar]]
[demo.example :refer [examples example-page]]))
[example.example :refer [examples-wrapped]]

; examples
[example.pinkie]
[example.controls]
; from renderable-ui
[example.gtable]
; js based enderer
[example.highchart]
[example.json]
[example.vega]
[example.math]
; reagent based renderer
[example.leaflet]
[example.sparklines]
[example.player]
[example.aggrid]
[example.clock]
[example.gridlayout]
[example.pydoc]))

(def welcome
[:section {:class "text-gray-700 body-font"}
Expand All @@ -15,26 +33,17 @@
:viewBox "0 0 975.036 975.036"}
[:path {:d "M925.036 57.197h-304c-27.6 0-50 22.4-50 50v304c0 27.601 22.4 50 50 50h145.5c-1.9 79.601-20.4 143.3-55.4 191.2-27.6 37.8-69.399 69.1-125.3 93.8-25.7 11.3-36.8 41.7-24.8 67.101l36 76c11.6 24.399 40.3 35.1 65.1 24.399 66.2-28.6 122.101-64.8 167.7-108.8 55.601-53.7 93.7-114.3 114.3-181.9 20.601-67.6 30.9-159.8 30.9-276.8v-239c0-27.599-22.401-50-50-50zM106.036 913.497c65.4-28.5 121-64.699 166.9-108.6 56.1-53.7 94.4-114.1 115-181.2 20.6-67.1 30.899-159.6 30.899-277.5v-239c0-27.6-22.399-50-50-50h-304c-27.6 0-50 22.4-50 50v304c0 27.601 22.4 50 50 50h145.5c-1.9 79.601-20.4 143.3-55.4 191.2-27.6 37.8-69.4 69.1-125.3 93.8-25.7 11.3-36.8 41.7-24.8 67.101l35.9 75.8c11.601 24.399 40.501 35.2 65.301 24.399z"}]]
[:p {:class "leading-relaxed text-lg"}
"enjoy the demos ..."]
"enjoy the examples ..."]
[:span {:class "inline-block h-1 w-10 rounded bg-indigo-500 mt-8 mb-6"}]
[:h2 {:class "text-gray-900 font-medium title-font tracking-wider text-sm"}
"gorilla"]
[:p {:class "text-gray-500"}
"UI"]]]])

#_(def examples (r/atom
[{:name "a" :component [:h1 "a"]}
{:name "b" :component [:h1 "b"]}]))

(def examples-wrapped
(map (fn [e]
(assoc e :page (example-page e))) @examples))

(defn app []
(defn example-component [nsf]
[:div
;[:link {:rel "stylesheet" :href "tailwindcss/dist/tailwind.css"}]
;[modal-container]
[sidebar examples-wrapped welcome]])
[sidebar (examples-wrapped nsf) welcome]])


(defmethod reagent-page :demo/main [& args]
[app])

0 comments on commit 6633d48

Please sign in to comment.