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

interface IProps {
	onMatchFound: any;
	searchBoxText: string;
	filterStrings: string[];
	name: string;
	data: any;
	isNonenumerable: boolean;
}
/**
 * if isNonenumerable is specified, render the name dimmed
 */
const ObjectLabel = ({ onMatchFound, searchBoxText, filterStrings, name, data, isNonenumerable = false }: IProps) => (
	<span>
		<ObjectName
			onMatchFound={onMatchFound}
			searchBoxText={searchBoxText}
			filterStrings={filterStrings}
			name={name}
			dimmed={isNonenumerable}
		/>
		<span>: </span>
		<ObjectValue
			onMatchFound={onMatchFound}
			searchBoxText={searchBoxText}
			filterStrings={filterStrings}
			object={data}
		/>
	</span>
);

export default ObjectLabel;
