-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend): add UIx, add ReactFlow
- Loading branch information
Showing
4 changed files
with
30 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
/* From: https://unpkg.com/[email protected]/dist/style.css */ | ||
|
||
/* this gets exported as style.css and can be used for the default theming */ | ||
/* these are the necessary styles for React Flow, they get used by base.css and style.css */ | ||
.react-flow { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,6 @@ | |
(defn go [] | ||
(stop) | ||
(start)) | ||
|
||
(defn cljs-repl [] | ||
(shadow.cljs.devtools.api/repl :frontend)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,28 @@ | ||
(ns parts.frontend.app | ||
(:require | ||
["htmx.org" :default htmx])) | ||
["htmx.org" :default htmx] | ||
[uix.core :refer [defui $]] | ||
[uix.dom] | ||
["reactflow" :refer [ReactFlow]])) | ||
|
||
(def initial-nodes | ||
[{:id "1" :position {:x 0 :y 0} :data {:label "1"}} | ||
{:id "2" :position {:x 0 :y 100} :data {:label "2"}}]) | ||
|
||
(def initial-edges | ||
[{:id "e1-2" :source "1" :target "2"}]) | ||
|
||
(defui app [] | ||
($ :div {:style {:width "100vw" :height "100vh"}} | ||
($ ReactFlow {:nodes (clj->js initial-nodes) | ||
:edges (clj->js initial-edges)}))) | ||
|
||
(defonce root | ||
(uix.dom/create-root (js/document.getElementById "root"))) | ||
|
||
(defn ^:export init [] | ||
(.on htmx "htmx:load" | ||
(fn [evt] | ||
(fn [_] | ||
(uix.dom/render-root ($ app) root) | ||
(let [version (.-version htmx)] | ||
(js/console.log "HTMX loaded! Version:" version))))) |