From d70004da8a46048d1647217d7534b1ece12012c1 Mon Sep 17 00:00:00 2001 From: Gabriel Giovanini Date: Sun, 23 Jun 2019 19:05:12 +0200 Subject: Update to layout --- src/genpass/components/button.cljc | 6 ------ src/genpass/components/input.cljc | 12 ++++++++---- src/genpass/core.cljs | 30 ++++++------------------------ 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"))) -- cgit v1.2.3