aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Giovanini <gabrielg.desouza@gmail.com>2019-06-23 19:05:12 +0200
committerGabriel Giovanini <gabrielg.desouza@gmail.com>2019-06-23 19:05:12 +0200
commitd70004da8a46048d1647217d7534b1ece12012c1 (patch)
treeb30defac3143d830359444b7f3a28aff590ed8cb
parent2bff4d31eb150b9fd4ed60f4f2177c3b8f74cd08 (diff)
downloadgenpass-d70004da8a46048d1647217d7534b1ece12012c1.tar.gz
genpass-d70004da8a46048d1647217d7534b1ece12012c1.tar.bz2
genpass-d70004da8a46048d1647217d7534b1ece12012c1.zip
Update to layout
-rw-r--r--src/genpass/components/button.cljc6
-rw-r--r--src/genpass/components/input.cljc12
-rw-r--r--src/genpass/core.cljs30
3 files changed, 14 insertions, 34 deletions
diff --git a/src/genpass/components/button.cljc b/src/genpass/components/button.cljc
index b226cac..1a20c08 100644
--- a/src/genpass/components/button.cljc
+++ b/src/genpass/components/button.cljc
@@ -5,9 +5,3 @@
{:value label
:type "button"
:on-click fn}])
-
-(defn button-success [label fn]
- [:input.button.is-primary.is-success
- {:value label
- :type "button"
- :on-click fn}])
diff --git a/src/genpass/components/input.cljc b/src/genpass/components/input.cljc
index 097d7aa..a5ae437 100644
--- a/src/genpass/components/input.cljc
+++ b/src/genpass/components/input.cljc
@@ -1,6 +1,10 @@
(ns genpass.components.input)
-(defn input-primary [text]
- [:input.input.is-primary
- {:type "text"
- :value text}]) \ No newline at end of file
+(defn input-primary
+ ([text]
+ (input-primary text #()))
+ ([text fn]
+ [:input.input.is-primary
+ {:type "text"
+ :value text
+ :on-click fn}])) \ No newline at end of file
diff --git a/src/genpass/core.cljs b/src/genpass/core.cljs
index adafa2d..81bf6a0 100644
--- a/src/genpass/core.cljs
+++ b/src/genpass/core.cljs
@@ -2,7 +2,7 @@
(:require
[reagent.core :as r]
[genpass.components.input :refer [input-primary]]
- [genpass.components.button :refer [button-primary button-success]]
+ [genpass.components.button :refer [button-primary]]
[genpass.gen :refer [genpwd]]))
(def size (r/atom 12))
@@ -14,27 +14,11 @@
(defn main-section []
[:div
- [:div.field>div.control
+ [:div.field
(input-primary @password)]
- [:div.field>div.control>input.input.is-primary
- {:type "number"
- :value @size
- :on-change #(update-pwd (-> % .-target .-value))}]
- [:div.field.is-narrow
+ [:div.field.is-grouped.is-grouped-centered
[:div.control
- [:label.checkbox
- [:input {:type "checkbox"}] "Has Letters"]]
- [:div.control
- [:label.checkbox
- [:input {:type "checkbox"}] "Has Numbers"]]
- [:div.control
- [:label.checkbox
- [:input {:type "checkbox"}] "Has Symbols"]]]
- [:div.field.is-grouped
- [:div.control
- (button-primary "Generate" #(update-pwd @size))]
- [:div.control
- (button-success "Copy" #(update-pwd @size))]]])
+ (button-primary "Generate" #(update-pwd @size))]]])
(defn home-page []
[:div
@@ -42,10 +26,8 @@
{:role "navigation"
:aria-label "main navigation"}
[:div.navbar-brand>a.navbar-item>h1
- [:a
- {:href "https://github.com//gabrielgio/genpass"}
- "Genpass source code"]]]
- [:section.section>div.container (main-section)]])
+ [:a {:href "https://github.com//gabrielgio/genpass"} "Genpass source code"]]]
+ [:div.section.container (main-section)]])
(defn mount-root []
(r/render [home-page] (.getElementById js/document "app")))