import React from "react";
import ObjectName from "../object/ObjectName";
import ObjectPreview from "./ObjectPreview";

const ObjectRootLabel = ({ onMatchFound, searchBoxText, filterStrings, name, data }) => {
	if (typeof name === "string") {
		return (
			<span>
				<ObjectName
					onMatchFound={onMatchFound}
					searchBoxText={searchBoxText}
					filterStrings={filterStrings}
					name={name}
				/>
				<span>: </span>
				<ObjectPreview
					onMatchFound={onMatchFound}
					searchBoxText={searchBoxText}
					filterStrings={filterStrings}
					data={data}
				/>
			</span>
		);
	}
	return (
		<ObjectPreview
			onMatchFound={onMatchFound}
			searchBoxText={searchBoxText}
			filterStrings={filterStrings}
			data={data}
		/>
	);
};

export default ObjectRootLabel;
