♻️ remove new css from other elements

This commit is contained in:
Eva 2024-01-04 15:37:24 +01:00 committed by Andrey Antukh
parent 480251c41c
commit c14fe661df
19 changed files with 702 additions and 1539 deletions

View file

@ -5,8 +5,9 @@
;; Copyright (c) KALEIDOS INC
(ns app.main.ui.components.editable-label
(:require-macros [app.main.style :as stl])
(:require
[app.main.ui.context :as ctx]
[app.common.data.macros :as dm]
[app.main.ui.icons :as i]
[app.util.dom :as dom]
[app.util.keyboard :as kbd]
@ -16,16 +17,14 @@
(mf/defc editable-label
{::mf/wrap-props false}
[props]
(let [display-value (unchecked-get props "display-value")
value (unchecked-get props "value")
(let [value (unchecked-get props "value")
on-change (unchecked-get props "on-change")
on-cancel (unchecked-get props "on-cancel")
editing? (unchecked-get props "editing")
dbl-click? (unchecked-get props "disable-dbl-click")
class (unchecked-get props "class")
tooltip (unchecked-get props "tooltip")
new-css-system (mf/use-ctx ctx/new-css-system)
final-class (dm/str class " " (stl/css :editable-label))
input-ref (mf/use-ref nil)
internal-editing* (mf/use-state false)
internal-editing? (deref internal-editing*)
@ -83,20 +82,15 @@
(when (and editing? (not internal-editing?))
(start-edition)))
(if ^boolean internal-editing?
[:div.editable-label {:class class}
[:input.editable-label-input
{:ref input-ref
:default-value value
:on-key-up on-key-up
:on-blur cancel-edition}]
[:div {:class final-class}
[:input
{:class (stl/css :editable-label-input)
:ref input-ref
:default-value value
:on-key-up on-key-up
:on-double-click on-dbl-click
:on-blur cancel-edition}]
[:span.editable-label-close {:on-click cancel-edition}
(if ^boolean new-css-system
i/delete-text-refactor
i/close)]]
[:span.editable-label
{:class class
:title tooltip
:on-double-click on-dbl-click}
display-value])))
[:span {:class (stl/css :editable-label-close)
:on-click cancel-edition}
i/delete-text-refactor]]))