aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Giovanini <gabrielg.desouza@gmail.com>2019-06-23 21:03:12 +0200
committerGabriel Giovanini <gabrielg.desouza@gmail.com>2019-06-23 21:03:12 +0200
commit927b25e3dddde019274a4c5237b8a37d1024b419 (patch)
treea8bca041cb5170f04b2bf94444b130f7bf1f61b2
parent8c716d495a5bf1d31c316da16635a32a291a34c0 (diff)
downloadgenpass-927b25e3dddde019274a4c5237b8a37d1024b419.tar.gz
genpass-927b25e3dddde019274a4c5237b8a37d1024b419.tar.bz2
genpass-927b25e3dddde019274a4c5237b8a37d1024b419.zip
Simplyfies things
-rw-r--r--src/genpass/components/button.cljc7
-rw-r--r--src/genpass/components/input.cljc13
-rw-r--r--src/genpass/core.cljs26
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")))