 (ns swarmpit.component.page-login
-  (:require [material.component :as comp]
-            [material.icon :as icon]
+  (:require [material.icon :as icon]
+            [material.component :as comp]
             [swarmpit.component.state :as state]
             [swarmpit.url :refer [dispatch!]]
             [swarmpit.storage :as storage]

    (login-handler local-state)))

(defn- form-username [value local-state]
  (comp/form-control
    {:margin    "normal"
     :required  true
     :fullWidth true}
    (comp/input-label
      {:htmlFor "user"
       :key     "Swarmpit-login-username-input-label"} "User")
    (comp/input
      {:id           "user"
       :key          "Swarmpit-login-username-input"
       :name         "user"
       :autoComplete "user"
       :autoFocus    true
       :value        value
       :onChange     (fn [event]
                       (swap! local-state assoc :username (-> event .-target .-value)))})))

(defn- form-password-adornment [local-state]
  (let [show-password? (:showPassword @local-state)]

      (comp/mui
        (comp/paper
          {:className "Swarmpit-login-paper"}
          (html
            [:img {:src    "img/swarmpit.png"
                   :width  "100%"
                   :height "100%"}])
          (html
            [:form.Swarmpit-login-form {:key "Swarmpit-login-form"}
             (when (not-empty message)
