Skip to content

Commit

Permalink
Improved selection and toggling for props/hooks/state
Browse files Browse the repository at this point in the history
1. Enable nested values to be expanded/collapsed by clicking on values as well as keys.
2. Enable keys and values to be seletable (for copy-pasting purposes)
  • Loading branch information
Brian Vaughn committed Dec 12, 2019
1 parent 12c0004 commit fd9edc8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
.Name,
.NameAnonymous {
flex: 0 0 auto;
user-select: none;
cursor: default;
}
.Name {
color: var(--color-dim);
Expand All @@ -39,7 +39,7 @@
.EditableName {
color: var(--color-attribute-name);
flex: 0 0 auto;
user-select: none;
cursor: default;
}
.EditableName:after,
.Name:after {
Expand All @@ -52,6 +52,7 @@
color: var(--color-attribute-value);
overflow: hidden;
text-overflow: ellipsis;
cursor: default;
}

.None {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ function HookView({canEditHooks, hook, id, inspectPath, path}: HookViewProps) {
{name || 'Anonymous'}
</span>{' '}
{/* $FlowFixMe */}
<span className={styles.Value}>{displayValue}</span>
<span className={styles.Value} onClick={toggleIsOpen}>
{displayValue}
</span>
</div>
<div className={styles.Children} hidden={!isOpen}>
{subHooksView}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
.Name {
color: var(--color-dim);
flex: 0 0 auto;
user-select: none;
cursor: default;
}
.EditableName {
color: var(--color-attribute-name);
flex: 0 0 auto;
user-select: none;
cursor: default;
}
.EditableName:after,
.Name:after {
Expand All @@ -24,6 +24,7 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: default;
}

.None {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ export default function KeyValue({
onClick={isInspectable ? toggleIsOpen : undefined}>
{name}
</span>
<span className={styles.Value}>{getMetaValueLabel(value)}</span>
<span
className={styles.Value}
onClick={isInspectable ? toggleIsOpen : undefined}>
{getMetaValueLabel(value)}
</span>
</div>
);
} else {
Expand Down Expand Up @@ -165,7 +169,11 @@ export default function KeyValue({
onClick={hasChildren ? toggleIsOpen : undefined}>
{name}
</span>
<span className={styles.Value}>{displayName}</span>
<span
className={styles.Value}
onClick={hasChildren ? toggleIsOpen : undefined}>
{displayName}
</span>
</div>,
);
} else {
Expand Down Expand Up @@ -211,7 +219,11 @@ export default function KeyValue({
onClick={hasChildren ? toggleIsOpen : undefined}>
{name}
</span>
<span className={styles.Value}>{displayName}</span>
<span
className={styles.Value}
onClick={hasChildren ? toggleIsOpen : undefined}>
{displayName}
</span>
</div>,
);
}
Expand Down

0 comments on commit fd9edc8

Please sign in to comment.