0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-12 07:41:43 -05:00

Typographic styles enhancements and fixes

This commit is contained in:
alonso.torres 2020-10-16 09:37:33 +02:00 committed by Andrey Antukh
parent a7335533bb
commit 447bb5204d
5 changed files with 37 additions and 22 deletions

View file

@ -768,6 +768,17 @@
z-index: 10; z-index: 10;
} }
.advanced-options-wrapper {
position: absolute;
width: 100%;
padding-right: 1.5rem;
padding-left: 0.25rem;
}
.element-options .advanced-options-wrapper {
padding-right: 1rem;
}
.advanced-options { .advanced-options {
background-color: #303236; background-color: #303236;
border-radius: 4px; border-radius: 4px;

View file

@ -533,7 +533,8 @@
:sync-dialog)))))) :sync-dialog))))))
(defn add-typography (defn add-typography
[typography] ([typography] (add-typography typography true))
([typography edit?]
(let [typography (update typography :id #(or % (uuid/next)))] (let [typography (update typography :id #(or % (uuid/next)))]
(us/assert ::cp/typography typography) (us/assert ::cp/typography typography)
(ptk/reify ::add-typography (ptk/reify ::add-typography
@ -544,9 +545,9 @@
uchg {:type :del-typography uchg {:type :del-typography
:id (:id typography)}] :id (:id typography)}]
(rx/of (dwc/commit-changes [rchg] [uchg] {:commit-local? true}) (rx/of (dwc/commit-changes [rchg] [uchg] {:commit-local? true})
#(assoc-in % #(cond-> %
[:workspace-local :rename-typography] edit?
(:id typography)))))))) (assoc-in [:workspace-local :rename-typography] (:id typography))))))))))
(defn update-typography (defn update-typography
[typography] [typography]

View file

@ -391,7 +391,9 @@
handle-delete-typography handle-delete-typography
(fn [] (fn []
(st/emit! (dwl/delete-typography (:id @state))))] (st/emit! (dwl/delete-typography (:id @state))))
editting-id (or (:rename-typography local) (:edit-typography local))]
(mf/use-effect (mf/use-effect
(mf/deps local) (mf/deps local)
@ -428,8 +430,7 @@
:on-context-menu #(on-context-menu (:id typography) %) :on-context-menu #(on-context-menu (:id typography) %)
:on-change #(handle-change typography %) :on-change #(handle-change typography %)
:on-select #(handle-typography-selection typography) :on-select #(handle-typography-selection typography)
:editting? (or (= (:rename-typography local) (:id typography)) :editting? (= editting-id (:id typography))
(= (:edit-typography local) (:id typography)))
:focus-name? (= (:rename-typography local) (:id typography))}])])])) :focus-name? (= (:rename-typography local) (:id typography))}])])]))
(defn file-colors-ref (defn file-colors-ref

View file

@ -19,6 +19,7 @@
(when visible? (when visible?
[:* [:*
[:div.focus-overlay {:on-click handle-click}] [:div.focus-overlay {:on-click handle-click}]
[:div.advanced-options-wrapper
[:div.advanced-options {} [:div.advanced-options {}
children]]))) children]]])))

View file

@ -215,7 +215,7 @@
(get typographies (:typography-ref-id values))) (get typographies (:typography-ref-id values)))
handle-click on-convert-to-typography
(mf/use-callback (mf/use-callback
(mf/deps values) (mf/deps values)
(fn [event] (fn [event]
@ -227,7 +227,7 @@
typography (merge ut/default-typography setted-values) typography (merge ut/default-typography setted-values)
typography (generate-typography-name typography)] typography (generate-typography-name typography)]
(let [id (uuid/next)] (let [id (uuid/next)]
(st/emit! (dwl/add-typography (assoc typography :id id))) (st/emit! (dwl/add-typography (assoc typography :id id) false))
(run! #(emit-update! % {:typography-ref-id id}) ids))))) (run! #(emit-update! % {:typography-ref-id id}) ids)))))
handle-deattach-typography handle-deattach-typography
@ -251,7 +251,8 @@
[:div.element-set [:div.element-set
[:div.element-set-title [:div.element-set-title
[:span label] [:span label]
[:div.add-page {:on-click handle-click} i/close]] (when (not typography)
[:div.add-page {:on-click on-convert-to-typography} i/close])]
(cond (cond
typography typography