💄 Format frontend code

This commit is contained in:
Andrey Antukh 2024-01-05 14:23:30 +01:00 committed by Alonso Torres
parent b6ecc8b1be
commit 833871df65
150 changed files with 1735 additions and 1770 deletions

View file

@ -1,10 +1,10 @@
(ns app.main.ui.components.buttons.simple-button
(:require-macros [app.main.style :as stl])
(:require
[rumext.v2 :as mf]))
[rumext.v2 :as mf]))
(mf/defc simple-button
{::mf/wrap-props false}
[{:keys [on-click children]}]
[:button {:on-click on-click :class (stl/css :button)} children])
[:button {:on-click on-click :class (stl/css :button)} children])

View file

@ -37,11 +37,11 @@
(cond
(:gradient color)
[:div.color-bullet-wrapper {:style {:background (uc/color->background color)}}]
(:image color)
(let [uri (cfg/resolve-file-media (:image color))]
[:div.color-bullet-wrapper {:style {:background-size "contain" :background-image (str/ffmt "url(%)" uri)}}])
:else
[:div.color-bullet-wrapper
[:div.color-bullet-left {:style {:background (uc/color->background (assoc color :opacity 1))}}]

View file

@ -114,20 +114,20 @@
on-mouse-up
(mf/use-fn
(fn [event]
(dom/prevent-default event)))
(fn [event]
(dom/prevent-default event)))
handle-focus
(mf/use-fn
(fn [event]
(let [target (dom/get-target event)]
(when on-focus
(on-focus event))
(fn [event]
(let [target (dom/get-target event)]
(when on-focus
(on-focus event))
(when select-on-focus?
(-> event (dom/get-target) (.select))
(when select-on-focus?
(-> event (dom/get-target) (.select))
;; In webkit browsers the mouseup event will be called after the on-focus causing and unselect
(.addEventListener target "mouseup" on-mouse-up #js {"once" true})))))
(.addEventListener target "mouseup" on-mouse-up #js {"once" true})))))
props (-> (obj/clone props)
(obj/unset! "selectOnFocus")

View file

@ -361,17 +361,17 @@
(zero? (count @items)))
klass (str (get props :class) " "
(stl/css-case
:focus @focus?
:valid (and touched? (not error))
:invalid (and touched? error)
:empty empty?
:custom-multi-input true))
(stl/css-case
:focus @focus?
:valid (and touched? (not error))
:invalid (and touched? error)
:empty empty?
:custom-multi-input true))
in-klass (str class " "
(stl/css-case
:inside-input true
:no-padding (pos? (count @items))))
(stl/css-case
:inside-input true
:no-padding (pos? (count @items))))
on-focus
(mf/use-fn #(reset! focus? true))
@ -481,7 +481,7 @@
(> (count value) length))
(defn validate-length
[field length errors-msg ]
[field length errors-msg]
(fn [errors data]
(cond-> errors
(max-length? (get data field) length)
@ -500,6 +500,6 @@
(let [value (get data field)]
(cond-> errors
(and
(all-spaces? value)
(> (count value) 0))
(all-spaces? value)
(> (count value) 0))
(assoc field {:message error-msg})))))

View file

@ -18,4 +18,4 @@
(keyboard-action event)))
:tab-index "0"
:data-test data-test}
[:* children]]))
[:* children]]))

View file

@ -46,7 +46,7 @@
(when ^boolean enter? (dom/blur! node))
(when ^boolean esc? (dom/blur! node)))))]
[:span {:class (stl/css-case :search-box true
:has-children (some? children))}
:has-children (some? children))}
children
[:div {:class (stl/css :search-input-wrapper)}
icon

View file

@ -50,7 +50,7 @@
(when (fn? on-change) (on-change id)))))]
[:div {:class (stl/css :tab-container)}
[:div {:class (dm/str class " "(stl/css :tab-container-tabs))}
[:div {:class (dm/str class " " (stl/css :tab-container-tabs))}
(when collapsable?
[:button
{:on-click handle-collapse
@ -67,7 +67,7 @@
:data-id (d/name id)
:on-click select-fn
:class (stl/css-case :tab-container-tab-title true
:current (= selected id))}
:current (= selected id))}
title]))]]
[:div {:class (dm/str content-class " " (stl/css :tab-container-content ))}
[:div {:class (dm/str content-class " " (stl/css :tab-container-content))}
(d/seek #(= selected (-> % .-props .-id)) children)]]))