diff --git a/catalog/app/components/JsonDisplay/JsonDisplay.js b/catalog/app/components/JsonDisplay/JsonDisplay.js index 9e4e1cac938..dc84f1da224 100644 --- a/catalog/app/components/JsonDisplay/JsonDisplay.js +++ b/catalog/app/components/JsonDisplay/JsonDisplay.js @@ -16,9 +16,15 @@ const useStyles = M.makeStyles((t) => ({ fontFamily: t.typography.monospace.fontFamily, fontSize: t.typography.body2.fontSize, overflow: 'auto', + padding: '1px', // makes `outline` visible when `overflow: hidden` whiteSpace: 'pre', width: '100%', }, + container: { + alignItems: 'start', + display: 'flex', + flexDirection: 'column', + }, more: { color: t.palette.text.secondary, }, @@ -26,6 +32,9 @@ const useStyles = M.makeStyles((t) => ({ display: 'flex', }, compoundInner: { + alignItems: 'start', + display: 'flex', + flexDirection: 'column', paddingLeft: t.spacing(2), }, hidden: { @@ -43,6 +52,18 @@ const useStyles = M.makeStyles((t) => ({ brace: { color: t.palette.text.secondary, }, + clickable: { + cursor: 'pointer', + '&:hover': { + outline: `1px dotted ${t.palette.text.primary}`, + }, + }, + topLevelIcon: { + margin: '1px 0 0 1px', + }, + tailingBrace: { + padding: t.spacing(0, 0.5), + }, })) const IconBlank = ({ classes }) =>
@@ -199,6 +220,7 @@ function CollapsedEntry({ availableSpace, value, showValuesWhenCollapsed }) { } function CompoundEntry({ + className, name, value, topLevel = true, @@ -225,9 +247,8 @@ function CompoundEntry({ ]) return ( -
- {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */} -
+
+
{/* TODO: use icon rotation like MUI ? */} {empty ? ( // eslint-disable-line no-nested-ternary !topLevel && @@ -258,6 +279,7 @@ function CompoundEntry({
{entries.map(([k, v]) => ( ))} - {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */} -
{braces[1]}
+
+ {braces[1]} +
)} @@ -342,6 +365,7 @@ export default function JsonDisplay({ classes, showValuesWhenCollapsed, }} + className={classes.container} showKeysWhenCollapsed={computedKeys} /> diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 930bcd09e0d..4ea38f28204 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -38,6 +38,7 @@ Entries inside each section should be ordered by type: * [Changed] Allow users select files and directories and keep selection whenever they navigate to multiple directories or use filter ([#3527](https://github.com/quiltdata/quilt/pull/3527)) * [Changed] Unify per-bucket and global search ([#3613](https://github.com/quiltdata/quilt/pull/3613)) * [Changed] Allow use of
in Markdown ([#3720](https://github.com/quiltdata/quilt/pull/3720)) +* [Changed] JSON display: highlight clickable on hover, minor layout changes ([#3734](https://github.com/quiltdata/quilt/pull/3734)) # 5.3.1 - 2023-05-02 ## Python API