fix: library not scrollable when no published items installed (#5352)

* fix: library not scrollable when no published items installed

* show empty lib message in one case & fix i18n
This commit is contained in:
David Luzar 2022-06-25 20:10:53 +02:00 committed by GitHub
parent 9135ebf2e2
commit 120c8f373c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 3 deletions

View File

@ -428,7 +428,7 @@ const LibraryMenuItems = ({
align="start" align="start"
gap={1} gap={1}
style={{ style={{
flex: publishedItems.length > 0 ? 1 : "0 0 auto", flex: publishedItems.length > 0 ? 1 : "0 1 auto",
marginBottom: 0, marginBottom: 0,
}} }}
> >
@ -467,7 +467,7 @@ const LibraryMenuItems = ({
fontSize: ".9rem", fontSize: ".9rem",
}} }}
> >
No items yet! {t("library.noItems")}
<div <div
style={{ style={{
margin: ".6rem 0", margin: ".6rem 0",
@ -498,7 +498,23 @@ const LibraryMenuItems = ({
(pendingElements.length > 0 || unpublishedItems.length > 0))) && ( (pendingElements.length > 0 || unpublishedItems.length > 0))) && (
<div className="separator">{t("labels.excalidrawLib")}</div> <div className="separator">{t("labels.excalidrawLib")}</div>
)} )}
{publishedItems.length > 0 && renderLibrarySection(publishedItems)} {publishedItems.length > 0 ? (
renderLibrarySection(publishedItems)
) : unpublishedItems.length > 0 ? (
<div
style={{
margin: "1rem 0",
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
width: "100%",
fontSize: ".9rem",
}}
>
{t("library.noItems")}
</div>
) : null}
</> </>
</Stack.Col> </Stack.Col>
); );

View File

@ -124,6 +124,7 @@
"sidebarLock": "Keep sidebar open" "sidebarLock": "Keep sidebar open"
}, },
"library": { "library": {
"noItems": "No items added yet...",
"hint_emptyLibrary": "Select an item on canvas to add it here, or install a library from the public repository, below.", "hint_emptyLibrary": "Select an item on canvas to add it here, or install a library from the public repository, below.",
"hint_emptyPrivateLibrary": "Select an item on canvas to add it here." "hint_emptyPrivateLibrary": "Select an item on canvas to add it here."
}, },