diff options
| -rw-r--r-- | src/genpass/components/button.cljc | 7 | ||||
| -rw-r--r-- | src/genpass/components/input.cljc | 13 | ||||
| -rw-r--r-- | src/genpass/core.cljs | 26 | 
3 files changed, 10 insertions, 36 deletions
| diff --git a/src/genpass/components/button.cljc b/src/genpass/components/button.cljc deleted file mode 100644 index 1a20c08..0000000 --- a/src/genpass/components/button.cljc +++ /dev/null @@ -1,7 +0,0 @@ -(ns genpass.components.button) - -(defn button-primary [label fn] -  [:input.button.is-primary -   {:value    label -    :type     "button" -    :on-click fn}]) diff --git a/src/genpass/components/input.cljc b/src/genpass/components/input.cljc deleted file mode 100644 index a4b8499..0000000 --- a/src/genpass/components/input.cljc +++ /dev/null @@ -1,13 +0,0 @@ -(ns genpass.components.input) - - -(defn input-primary -  ([text] -   (input-primary text #())) -  ([text fn] -   [:input.input.is-primary -    {:type     "text" -     :value    text -     :on-click fn}])) - - diff --git a/src/genpass/core.cljs b/src/genpass/core.cljs index f6e1b68..b207cb5 100644 --- a/src/genpass/core.cljs +++ b/src/genpass/core.cljs @@ -1,12 +1,9 @@  (ns genpass.core    (:require      [reagent.core :as r] -    [genpass.components.input :refer [input-primary]] -    [genpass.components.button :refer [button-primary]]      [genpass.gen :refer [genpwd]])) -(def size (r/atom 12)) -(def password (r/atom (genpwd @size))) +(def password (r/atom (genpwd)))  (defn magic-selection-trick-took-from-so [e]    (let [this (.-target e)] @@ -21,17 +18,6 @@            (.moveToElementText range)            (.select range this)))))) -(defn update-pwd [arg] -  (reset! size arg) -  (reset! password (genpwd @size))) - -(defn main-section [] -  [:div -   [:div.field.has-text-centered -    [:span.title.is-2 {:on-click magic-selection-trick-took-from-so} @password]] -   [:div.field.is-grouped.is-grouped-centered -    [:div.control -     (button-primary "Generate" #(update-pwd @size))]]])  (defn home-page []    [:div @@ -40,7 +26,15 @@       :aria-label "main navigation"}      [:div.navbar-brand>a.navbar-item>h1       [:a {:href "https://github.com//gabrielgio/genpass"} "Genpass source code"]]] -   [:div.section.container (main-section)]]) +   [:div.section.container +    [:div.field.has-text-centered +     [:span.title.is-3 {:on-click magic-selection-trick-took-from-so} @password]] +    [:div.field.is-grouped.is-grouped-centered +     [:div.control +      [:input.button.is-primary +       {:value    "Generate" +        :type     "button" +        :on-click #(reset! password (genpwd))}]]]]])  (defn mount-root []    (r/render [home-page] (.getElementById js/document "app"))) | 
