0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-09 16:48:16 -05:00

Add a little improvent in recent fonts selector

This commit is contained in:
Eva 2022-02-04 14:52:46 +01:00 committed by Alonso Torres
parent 7134bbf484
commit 38b7474f0b
4 changed files with 26 additions and 12 deletions

View file

@ -1169,7 +1169,6 @@
header {
display: flex;
align-items: center;
flex-direction: column;
position: relative;
@ -1225,9 +1224,15 @@
border-radius: $br-small;
color: $color-gray-20;
border: 1px solid $color-gray-30;
width: 88%;
margin: 15px 17px;
}
.title {
font-size: $fs14;
margin: 9px 17px;
}
.options {
display: flex;
justify-content: center;

View file

@ -143,9 +143,8 @@
(mf/deps on-select on-close)
(fn [font]
(on-select font)
(on-close)))
]
(on-close)))]
(mf/use-effect
(fn []
(st/emit! (fts/load-recent-fonts))))
@ -190,13 +189,16 @@
:ref input
:spell-check false
:on-change on-filter-change}]
[:hr]
(when recent-fonts
(for [font recent-fonts]
[:& font-item {:key (:id font)
:font font
:style {}
:on-click on-select-and-close
:current? (= (:id font) (:id @selected))}]))
[*
[:p.title (tr "workspace.options.recent-fonts")]
(for [font recent-fonts]
[:& font-item {:key (:id font)
:font font
:style {}
:on-click on-select-and-close
:current? (= (:id font) (:id @selected))}])])
#_[:div.options
{:on-click #(swap! state assoc :show-options true)
@ -257,6 +259,7 @@
fonts (mf/deref fonts/fontsdb)
font (get fonts font-id)
recent-fonts (mf/deref refs/workspace-recent-fonts)
last-font (mf/use-ref nil)
open-selector? (mf/use-state false)
@ -271,7 +274,7 @@
:font-variant-id (or id name)
:font-weight weight
:font-style style})
(st/emit! (fts/add-recent-font font)))))
(mf/set-ref-val! last-font font))))
on-font-size-change
(mf/use-callback
@ -309,7 +312,7 @@
(reset! open-selector? false)
(when (some? on-blur)
(on-blur))
))]
(st/emit! (fts/add-recent-font (mf/ref-val last-font)))))]
[:*
(when @open-selector?

View file

@ -2815,6 +2815,9 @@ msgstr "Rotation"
msgid "workspace.options.search-font"
msgstr "Search font"
msgid "workspace.options.recent-fonts"
msgstr "Recent"
#: src/app/main/ui/workspace/sidebar/options/menus/interactions.cljs
msgid "workspace.options.select-a-shape"
msgstr "Select a shape, artboard or group to drag a connection to other artboard."

View file

@ -2826,6 +2826,9 @@ msgstr "Rotación"
msgid "workspace.options.search-font"
msgstr "Buscar fuente"
msgid "workspace.options.recent-fonts"
msgstr "Recientes"
#: src/app/main/ui/workspace/sidebar/options/menus/interactions.cljs
msgid "workspace.options.select-a-shape"
msgstr ""