diff --git a/frontend/resources/styles/main/partials/sidebar-element-options.scss b/frontend/resources/styles/main/partials/sidebar-element-options.scss index 03c7f92d2..e9bd57dab 100644 --- a/frontend/resources/styles/main/partials/sidebar-element-options.scss +++ b/frontend/resources/styles/main/partials/sidebar-element-options.scss @@ -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; diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/typography.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/typography.cljs index 2d790de2f..41a642f3d 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/typography.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/typography.cljs @@ -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? diff --git a/frontend/translations/en.po b/frontend/translations/en.po index d25325f57..b3e1f68ed 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -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." diff --git a/frontend/translations/es.po b/frontend/translations/es.po index ca65a37fc..b771a1376 100644 --- a/frontend/translations/es.po +++ b/frontend/translations/es.po @@ -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 ""