mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-25 11:03:57 +03:00
81926f3212
* Remove UNSAFE method from JSONTree * Bump peer dep * Fix types * Remove proptypes * Remove unused * shouldExpandNode => shouldExpandNodeInitially * Cleanup * Update usages * Tighten types * Create four-parrots-poke.md * Format * Fix inspector-monitor types * Fix log-monitor types * Fix rtk-query-monitor types * Fix type
47 lines
979 B
TypeScript
47 lines
979 B
TypeScript
import React from 'react';
|
|
import type {
|
|
GetItemString,
|
|
Key,
|
|
KeyPath,
|
|
LabelRenderer,
|
|
Styling,
|
|
ValueRenderer,
|
|
} from './types';
|
|
|
|
/**
|
|
* Renders simple values (eg. strings, numbers, booleans, etc)
|
|
*/
|
|
|
|
interface Props {
|
|
getItemString: GetItemString;
|
|
key: Key;
|
|
keyPath: KeyPath;
|
|
labelRenderer: LabelRenderer;
|
|
nodeType: string;
|
|
styling: Styling;
|
|
value: unknown;
|
|
valueRenderer: ValueRenderer;
|
|
valueGetter?: (value: any) => unknown;
|
|
}
|
|
|
|
export default function JSONValueNode({
|
|
nodeType,
|
|
styling,
|
|
labelRenderer,
|
|
keyPath,
|
|
valueRenderer,
|
|
value,
|
|
valueGetter = (value) => value,
|
|
}: Props) {
|
|
return (
|
|
<li {...styling('value', nodeType, keyPath)}>
|
|
<label {...styling(['label', 'valueLabel'], nodeType, keyPath)}>
|
|
{labelRenderer(keyPath, nodeType, false, false)}
|
|
</label>
|
|
<span {...styling('valueText', nodeType, keyPath)}>
|
|
{valueRenderer(valueGetter(value), value, ...keyPath)}
|
|
</span>
|
|
</li>
|
|
);
|
|
}
|