mirror of https://github.com/status-im/reagent.git
Rename demoutil
This commit is contained in:
parent
1d48785a42
commit
ce9afb470c
|
@ -4,7 +4,6 @@
|
||||||
[reagentdemo.page :as rpage]
|
[reagentdemo.page :as rpage]
|
||||||
[reagentdemo.news :as news]
|
[reagentdemo.news :as news]
|
||||||
[reagentdemo.intro :as intro]
|
[reagentdemo.intro :as intro]
|
||||||
[demoutil :as demoutil :refer-macros [get-source]]
|
|
||||||
[reagentdemo.common :as common :refer [demo-component]]
|
[reagentdemo.common :as common :refer [demo-component]]
|
||||||
[reagent.debug :refer-macros [dbg println]]))
|
[reagent.debug :refer-macros [dbg println]]))
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
(ns reagentdemo.common
|
(ns reagentdemo.common
|
||||||
(:require [reagent.core :as reagent :refer [atom]]
|
(:require [reagent.core :as reagent :refer [atom]]
|
||||||
[demoutil :as demoutil :refer-macros [get-source]]
|
[reagent.debug :refer-macros [dbg println]]
|
||||||
[clojure.string :as string]
|
[clojure.string :as string]
|
||||||
[reagent.debug :refer-macros [dbg println]]))
|
[reagentdemo.syntax :as syntax]))
|
||||||
|
|
||||||
(def syntaxify (memoize demoutil/syntaxify))
|
(def syntaxify (memoize syntax/syntaxify))
|
||||||
|
|
||||||
(defn src-parts [src]
|
(defn src-parts [src]
|
||||||
(string/split src #"\n(?=[(])"))
|
(string/split src #"\n(?=[(])"))
|
||||||
|
@ -31,8 +31,7 @@
|
||||||
[:pre (-> funmap (src-for-names defs) syntaxify)])
|
[:pre (-> funmap (src-for-names defs) syntaxify)])
|
||||||
|
|
||||||
(defn demo-component [{:keys [comp src complete]}]
|
(defn demo-component [{:keys [comp src complete]}]
|
||||||
(let [colored src
|
(let [showing (atom true)]
|
||||||
showing (atom true)]
|
|
||||||
(fn []
|
(fn []
|
||||||
[:div
|
[:div
|
||||||
(when comp
|
(when comp
|
||||||
|
@ -49,4 +48,4 @@
|
||||||
(when @showing
|
(when @showing
|
||||||
[:div.demo-source
|
[:div.demo-source
|
||||||
[:h3.demo-heading "Source"]
|
[:h3.demo-heading "Source"]
|
||||||
colored])])))
|
src])])))
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
(:require [reagent.core :as reagent :refer [atom]]
|
(:require [reagent.core :as reagent :refer [atom]]
|
||||||
[reagent.debug :refer-macros [dbg println]]
|
[reagent.debug :refer-macros [dbg println]]
|
||||||
[clojure.string :as string]
|
[clojure.string :as string]
|
||||||
[demoutil :as demoutil :refer-macros [get-source]]
|
[reagentdemo.syntax :refer-macros [get-source]]
|
||||||
[reagentdemo.common :as common :refer [demo-component]]))
|
[reagentdemo.common :as common :refer [demo-component]]))
|
||||||
|
|
||||||
(defn simple-component []
|
(defn simple-component []
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(ns demoutil
|
(ns reagentdemo.syntax
|
||||||
(:require [clojure.java.io :as io]))
|
(:require [clojure.java.io :as io]))
|
||||||
|
|
||||||
(defmacro get-source [srcfile]
|
(defmacro get-source [srcfile]
|
|
@ -1,4 +1,4 @@
|
||||||
(ns demoutil
|
(ns reagentdemo.syntax
|
||||||
(:require [clojure.string :as string]))
|
(:require [clojure.string :as string]))
|
||||||
|
|
||||||
(def builtins #{"def" "defn" "ns" "atom" "let" "if" "when"
|
(def builtins #{"def" "defn" "ns" "atom" "let" "if" "when"
|
Loading…
Reference in New Issue