Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #584 align labels and give max width #585

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/graph/labels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ export default function Labels({ graph, categories, onClick, label, className =
}

return (
<div className={cn(className, "absolute top-10 flex flex-col gap-2 p-4 h-[95%] pointer-events-none", label === "RelationshipTypes" ? "items-end right-2" : "left-2")}>
<div className={cn(className, "absolute top-10 flex flex-col gap-2 p-4 max-w-[200px] h-[95%] pointer-events-none", label === "RelationshipTypes" ? "right-2" : "left-2")}>
{
label &&
<h1>{label}</h1>
}
<div className={cn("h-1 grow flex flex-col items-center gap-4 p-4")}>
<div className={cn("h-1 grow flex flex-col items-center gap-4")}>
{
isScrollable &&
<Button
Expand All @@ -49,10 +49,10 @@ export default function Labels({ graph, categories, onClick, label, className =
categories.map((category) => (
<li key={category.index}>
<Button
className={cn(category.name && "flex gap-2 items-center pointer-events-auto")}
className={cn(category.name && "w-full pointer-events-auto")}
label={category.name}
icon={
<div style={{ backgroundColor: `${graph.getCategoryColorValue(category.index)}` }} className={cn("w-6 h-6 rounded-full", label === "RelationshipTypes" && "opacity-50")} />
<div style={{ backgroundColor: `${graph.getCategoryColorValue(category.index)}` }} className={cn("min-w-6 min-h-6 rounded-full", label === "RelationshipTypes" && "opacity-50")} />
}
onClick={() => {
onClick(category)
Expand Down
Loading