Skip to content

Commit

Permalink
feat: show tag with array item count also when expanded
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Dec 8, 2021
1 parent 10fdedd commit b427fe7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/lib/components/modes/treemode/JSONNode.scss
Original file line number Diff line number Diff line change
Expand Up @@ -183,25 +183,27 @@
font-size: $font-size-small;
font-family: $font-family;
color: $white;
background: $light-gray-transparent;
border-radius: 2px;
cursor: pointer;
position: relative;
}

.tag {
display: inline-block;
padding: 0 4px 1px;
margin: 0 2px;
position: relative;
top: 1px;

height: $line-height - 2px;
line-height: $line-height - 4px;

background: $light-gray-transparent;

&:hover {
background: lighten($light-gray-transparent, 15%);
}

&.readonly {
color: $light-gray-transparent;
background: $background-gray;
cursor: inherit;
}
}

.identifier {
Expand Down
3 changes: 3 additions & 0 deletions src/lib/components/modes/treemode/JSONNode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@
<div class="meta-inner" data-type="selectable-value">
{#if expanded}
<div class="bracket expanded">[</div>
<span class="tag readonly">
{value.length} items
</span>
{:else}
<div class="bracket">[</div>
<button type="button" class="tag" on:click={handleExpand}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
background-color: $selection-background !important;
}
}

.tag.readonly {
background: transparent;
}
}

.insert-area {
Expand Down

0 comments on commit b427fe7

Please sign in to comment.