0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-05 03:21:26 -05:00

🐛 Fix library button condition and copy (#5889)

* 🐛 Fix library button condition and copy

* 📎 Add changes from feedback

* 📎 Add changes from feedback
This commit is contained in:
Marina López 2025-02-19 16:52:35 +01:00 committed by GitHub
parent 0784d6b62a
commit 5f61254a75
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 16 additions and 36 deletions

View file

@ -116,7 +116,7 @@
assets-tab
(mf/html [:& assets-toolbox {:size (- size 58)}])
(mf/html [:& assets-toolbox {:size (- size 58) :file-id file}])
tokens-tab
(when design-tokens?

View file

@ -8,6 +8,7 @@
(:require-macros [app.main.style :as stl])
(:require
[app.common.data.macros :as dm]
[app.common.types.components-list :as ctkl]
[app.main.data.modal :as modal]
[app.main.data.workspace :as dw]
[app.main.data.workspace.assets :as dwa]
@ -73,7 +74,7 @@
(mf/defc assets-toolbox
{::mf/wrap [mf/memo]
::mf/wrap-props false}
[{:keys [size]}]
[{:keys [size file-id]}]
(let [components-v2 (mf/use-ctx ctx/components-v2)
read-only? (mf/use-ctx ctx/workspace-read-only?)
filters* (mf/use-state
@ -89,7 +90,10 @@
section (:section filters)
ordering (:ordering filters)
reverse-sort? (= :desc ordering)
num-libs (count (mf/deref refs/libraries))
libs (mf/deref refs/libraries)
num-libs (count libs)
file (get libs (:id file-id))
components (mf/with-memo [file] (ctkl/components (:data file)))
toggle-ordering
(mf/use-fn
@ -159,7 +163,7 @@
[:article {:class (stl/css :assets-bar)}
[:div {:class (stl/css :assets-header)}
(when-not ^boolean read-only?
(if (= num-libs 1)
(if (and (= num-libs 1) (empty? components))
[:button {:class (stl/css :add-library-button)
:on-click show-libraries-dialog
:data-testid "libraries"}
@ -168,9 +172,7 @@
[:button {:class (stl/css :libraries-button)
:on-click show-libraries-dialog
:data-testid "libraries"}
[:span {:class (stl/css :libraries-icon)}
i/library]
(tr "workspace.assets.libraries")]))
(tr "workspace.assets.manage-library")]))
[:div {:class (stl/css :search-wrapper)}

View file

@ -26,42 +26,22 @@
margin-bottom: $s-4;
border-radius: $s-8;
.libraries-icon {
@include flexCenter;
width: $s-24;
height: 100%;
svg {
@include flexCenter;
@extend .button-icon;
stroke: var(--icon-foreground);
}
}
&:hover {
background-color: var(--button-secondary-background-color-hover);
color: var(--button-secondary-foreground-color-hover);
border: $s-1 solid var(--button-secondary-border-color-hover);
svg {
stroke: var(--button-secondary-foreground-color-hover);
}
}
&:focus {
background-color: var(--button-secondary-background-color-focus);
color: var(--button-secondary-foreground-color-focus);
border: $s-1 solid var(--button-secondary-border-color-focus);
svg {
stroke: var(--button-secondary-foreground-color-focus);
}
}
}
.add-library-button {
@extend .button-primary;
text-transform: uppercase;
@include uppercaseTitleTipography;
gap: $s-2;
height: $s-32;
width: 100%;

View file

@ -4206,6 +4206,9 @@ msgstr "Align top (%s)"
msgid "workspace.assets.add-library"
msgstr "Add library"
msgid "workspace.assets.manage-library"
msgstr "Manage library"
#: src/app/main/ui/workspace/sidebar/assets.cljs
#, unused
msgid "workspace.assets.assets"
@ -4275,10 +4278,6 @@ msgstr "Group"
msgid "workspace.assets.group-name"
msgstr "Group name"
#: src/app/main/ui/workspace/sidebar/assets.cljs:186
msgid "workspace.assets.libraries"
msgstr "Libraries"
#: src/app/main/ui/workspace/sidebar/assets/components.cljs:501
msgid "workspace.assets.list-view"
msgstr "List view"

View file

@ -4222,6 +4222,9 @@ msgstr "Alinear arriba (%s)"
msgid "workspace.assets.add-library"
msgstr "Añadir biblioteca"
msgid "workspace.assets.manage-library"
msgstr "Gestionar biblioteca"
#: src/app/main/ui/workspace/sidebar/assets.cljs
#, unused
msgid "workspace.assets.assets"
@ -4293,10 +4296,6 @@ msgstr "Agrupar"
msgid "workspace.assets.group-name"
msgstr "Nombre del grupo"
#: src/app/main/ui/workspace/sidebar/assets.cljs:186
msgid "workspace.assets.libraries"
msgstr "Bibliotecas"
#: src/app/main/ui/workspace/sidebar/assets/components.cljs:501
msgid "workspace.assets.list-view"
msgstr "Ver como lista"