import React from 'react'; interface Props { shades: Record; pathRoot: string; path: string; diff: Record; } function DiffRow({ diff, path }: Props) { const [shorten, setShorten] = React.useState(true); const oldValue = diff.item ? JSON.stringify(diff.item.lhs) : JSON.stringify(diff.lhs); const newValue = diff.item ? JSON.stringify(diff.item.rhs) : JSON.stringify(diff.rhs); const pathStr = path.length > 15 && shorten ? path.slice(0, 5) + '...' + path.slice(10) : path; return (
15 ? 'cursor-pointer' : ''} onClick={() => setShorten(false)}> {pathStr} {': '} {oldValue || 'undefined'} {' -> '} {newValue || 'undefined'}
); } export default DiffRow;