Skip to content
Snippets Groups Projects
nodeinfobar.tsx 1.89 KiB
Newer Older
import React from "react";
import TitleArea from "./titlearea";
import FancyScrollbar from "../fancyscrollbar";
import MediaArea from "./mediaarea";
import Neighbors from "./neighbors";
import { NodeType } from "../../../common/graph/nodetype";
import { Node } from "../../../common/graph/node";

interface InfoBarProps {
    height: number;
    nodeColors?: Map<string, NodeType>;
    nodeClickedCallback?: (node: Node) => void;
/**
 * Displays a sidebar showing information on a specific node.
 * @param height Height of the sidebar.
 * @param node Node which drives the presented information.
 * @param nodeColors Mapping of node types to colors.
 * @param onClose Optional callback, called when the menu is closed.
 * @param nodeClickedCallback Optional callback, called when a neighbor of the current node gets selected.
 * @constructor
 */
function NodeInfoBar({
    height,
    node,
    nodeClickedCallback,
}: InfoBarProps) {
        <div className={"node-info-bar"} style={{ height }}>
            <div className={"node-info-bar-close-button"} onClick={onClose}>
            <div className={"node-info-bar-info-area"}>
                    <TitleArea title={node.name} image={node.banner} />
                    <MediaArea
                        description={node.description}
                        image={node.banner}
                        video={node.video}
                        references={node.references}
                    />
                </FancyScrollbar>
            </div>
            <Neighbors
                neighbors={node.neighbors}
                nodeClickedCallback={nodeClickedCallback}
            />
        </div>
    );
}

export default NodeInfoBar;