fix: long link & cat name breaking layout

This commit is contained in:
Sonny
2023-05-02 20:11:05 +02:00
parent 1e3264e2a0
commit b38b0ab390
4 changed files with 27 additions and 5 deletions

View File

@@ -39,7 +39,7 @@ export default function Links({
return ( return (
<div className={styles["links-wrapper"]}> <div className={styles["links-wrapper"]}>
<h2 className={styles["category-header"]}> <h2 className={styles["category-header"]}>
<span> <span className={styles["category-name"]}>
{name} {name}
<span className={styles["links-count"]}> {links.length}</span> <span className={styles["links-count"]}> {links.length}</span>
</span> </span>

View File

@@ -3,16 +3,26 @@
.no-link, .no-link,
.no-category { .no-category {
min-width: 0;
display: flex; display: flex;
flex: 1; flex: 1;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
animation: fadein 0.3s both; animation: fadein 0.3s both;
& p {
min-width: 0;
width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
} }
.links-wrapper { .links-wrapper {
height: 100%; height: 100%;
min-width: 0;
padding: 10px; padding: 10px;
display: flex; display: flex;
flex: 1; flex: 1;
@@ -36,6 +46,13 @@
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
& .category-name {
width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
& .category-controls { & .category-controls {
display: flex; display: flex;
gap: 0.5em; gap: 0.5em;
@@ -46,6 +63,7 @@
.links { .links {
height: 100%; height: 100%;
width: 100%; width: 100%;
min-width: 0;
display: flex; display: flex;
flex: 1; flex: 1;
gap: 0.5em; gap: 0.5em;
@@ -101,9 +119,10 @@
} }
& .link-name { & .link-name {
display: flex; width: 100%;
align-items: center; text-overflow: ellipsis;
gap: 0.5em; white-space: nowrap;
overflow: hidden;
} }
& .link-name .link-category { & .link-name .link-category {

View File

@@ -9,16 +9,18 @@ export default function EditItem({
type, type,
id, id,
onClick, onClick,
className = "",
}: { }: {
type: "category" | "link"; type: "category" | "link";
id: Link["id"] | Category["id"]; id: Link["id"] | Category["id"];
onClick?: (event: any) => void; // FIXME: find good event type onClick?: (event: any) => void; // FIXME: find good event type
className?: string;
}) { }) {
return ( return (
<LinkTag <LinkTag
href={`/${type}/edit/${id}`} href={`/${type}/edit/${id}`}
title={`Edit ${type}`} title={`Edit ${type}`}
className={styles["action"]} className={`${styles["action"]} ${className ? className : ""}`}
onClick={onClick && onClick} onClick={onClick && onClick}
> >
<AiOutlineEdit /> <AiOutlineEdit />

View File

@@ -50,6 +50,7 @@ function MenuOptions({ id }: { id: number }): JSX.Element {
type="category" type="category"
id={id} id={id}
onClick={(event) => event.stopPropagation()} onClick={(event) => event.stopPropagation()}
className={styles["option-edit"]}
/> />
<RemoveItem type="category" id={id} /> <RemoveItem type="category" id={id} />
</div> </div>