From 7aadcdf624a9588128ef4bb54466f2880afe2aa7 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Fri, 12 Apr 2019 08:53:41 -0700 Subject: [PATCH] Use :hidden attribute to collapse props/hooks --- src/devtools/views/Components/HooksTree.js | 34 +++++------ src/devtools/views/Components/KeyValue.css | 2 +- src/devtools/views/Components/KeyValue.js | 66 +++++++++++++--------- 3 files changed, 54 insertions(+), 48 deletions(-) diff --git a/src/devtools/views/Components/HooksTree.js b/src/devtools/views/Components/HooksTree.js index ac6dee5ea1..81c19f650e 100644 --- a/src/devtools/views/Components/HooksTree.js +++ b/src/devtools/views/Components/HooksTree.js @@ -134,16 +134,14 @@ function HookView({ canEditHooks, hook, id, path = [] }: HookViewProps) { {name} - {isOpen && ( -
- - -
- )} + ); } else { @@ -157,15 +155,13 @@ function HookView({ canEditHooks, hook, id, path = [] }: HookViewProps) { {/* $FlowFixMe */} {displayValue} - {isOpen && ( -
- -
- )} + ); } diff --git a/src/devtools/views/Components/KeyValue.css b/src/devtools/views/Components/KeyValue.css index 892bee1a39..08230f57ac 100644 --- a/src/devtools/views/Components/KeyValue.css +++ b/src/devtools/views/Components/KeyValue.css @@ -1,4 +1,4 @@ -.Item { +.Item:not([hidden]) { display: flex; } diff --git a/src/devtools/views/Components/KeyValue.js b/src/devtools/views/Components/KeyValue.js index cfcb04cc70..955514de0d 100644 --- a/src/devtools/views/Components/KeyValue.js +++ b/src/devtools/views/Components/KeyValue.js @@ -12,6 +12,7 @@ type OverrideValueFn = (path: Array, value: any) => void; type KeyValueProps = {| depth: number, + hidden?: boolean, name: string, overrideValueFn?: ?OverrideValueFn, path?: Array, @@ -20,6 +21,7 @@ type KeyValueProps = {| export default function KeyValue({ depth, + hidden, name, overrideValueFn, path = [], @@ -60,7 +62,7 @@ export default function KeyValue({ typeof overrideValueFn === 'function' ? styles.EditableName : styles.Name; children = ( -
+