-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use common VertexRow component (#697)
* Use common VertexRow component * Remove RemoteSvgIcon * Update changelog
- Loading branch information
Showing
11 changed files
with
60 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
packages/graph-explorer/src/components/RemoteSvgIcon/RemoteSvgIcon.tsx
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
packages/graph-explorer/src/components/RemoteSvgIcon/index.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { | ||
useVertexTypeConfig, | ||
useVertexTypeConfigs, | ||
} from "@/core/ConfigurationProvider/useConfiguration"; | ||
import { Vertex } from "@/@types/entities"; | ||
import { useDisplayNames, useTextTransform } from "@/hooks"; | ||
import { VertexSymbol } from "."; | ||
import { ComponentPropsWithoutRef } from "react"; | ||
import { cn } from "@/utils"; | ||
|
||
export function VertexRow({ | ||
vertex, | ||
className, | ||
...props | ||
}: { vertex: Vertex } & ComponentPropsWithoutRef<"div">) { | ||
const getDisplayNames = useDisplayNames(); | ||
const textTransform = useTextTransform(); | ||
|
||
const { name, longName } = getDisplayNames(vertex); | ||
|
||
const vtConfigForStyling = useVertexTypeConfig(vertex.type); | ||
const vertexTypeConfigs = useVertexTypeConfigs(vertex.types ?? [vertex.type]); | ||
const vertexTypeDisplayLabels = vertexTypeConfigs | ||
.map(vtConfig => vtConfig.displayLabel || textTransform(vtConfig.type)) | ||
.join(", "); | ||
|
||
return ( | ||
<div | ||
className={cn("flex flex-row items-center gap-3", className)} | ||
{...props} | ||
> | ||
<VertexSymbol vtConfig={vtConfigForStyling} /> | ||
<div className="flex grow flex-col items-start"> | ||
<div className="text-base font-bold leading-snug"> | ||
{vertexTypeDisplayLabels} › {name} | ||
</div> | ||
<div className="text-text-secondary/90 line-clamp-2 text-base leading-snug"> | ||
{longName} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
packages/graph-explorer/src/modules/common/VertexHeader.tsx
This file was deleted.
Oops, something went wrong.