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;
}
.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 {
background-color: #303236;
border-radius: 4px;

View file

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

View file

@ -391,7 +391,9 @@
handle-delete-typography
(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/deps local)
@ -428,8 +430,7 @@
:on-context-menu #(on-context-menu (:id typography) %)
:on-change #(handle-change typography %)
:on-select #(handle-typography-selection typography)
:editting? (or (= (:rename-typography local) (:id typography))
(= (:edit-typography local) (:id typography)))
:editting? (= editting-id (:id typography))
:focus-name? (= (:rename-typography local) (:id typography))}])])]))
(defn file-colors-ref

View file

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

View file

@ -215,7 +215,7 @@
(get typographies (:typography-ref-id values)))
handle-click
on-convert-to-typography
(mf/use-callback
(mf/deps values)
(fn [event]
@ -227,7 +227,7 @@
typography (merge ut/default-typography setted-values)
typography (generate-typography-name typography)]
(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)))))
handle-deattach-typography
@ -251,7 +251,8 @@
[:div.element-set
[:div.element-set-title
[: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
typography