-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TreeSection
actions container styling
#1390
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
dc7548a
Start styling TreeSection actions
dotNomad 8d0347d
Move .title CSS under .pane-header
dotNomad 25611eb
Do not expand on actions click
dotNomad a783850
Do not allow TreeSection title selection
dotNomad a3613de
Make pane-header focus-able
dotNomad 6938593
Create toggleExpanded function helper
dotNomad f67c448
Support enter expand in TreeSection
dotNomad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,41 @@ | |
<div class="pane" :class="{ expanded: expanded }"> | ||
<div | ||
class="pane-header" | ||
tabindex="0" | ||
:class="{ expanded: expanded }" | ||
@click="expanded = !expanded" | ||
@keydown.enter.self="toggleExpanded" | ||
> | ||
<div | ||
class="twisty-container codicon" | ||
:class="expanded ? 'codicon-chevron-down' : 'codicon-chevron-right'" | ||
/> | ||
<h3 class="title">{{ title }}</h3> | ||
<div class="pane-header-title-container" @click="toggleExpanded"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created this, and used This is not how VSCode structures the DOM or styles it, but it looks and behaves functionality the same. |
||
<div | ||
class="twisty-container codicon" | ||
:class="expanded ? 'codicon-chevron-down' : 'codicon-chevron-right'" | ||
/> | ||
<h3 class="title">{{ title }}</h3> | ||
</div> | ||
<div class="actions"> | ||
<div class="monaco-toolbar"> | ||
<div class="monaco-action-bar"> | ||
<ul | ||
class="actions-container" | ||
role="toolbar" | ||
:aria-label="`${title} actions`" | ||
> | ||
<li | ||
class="action-item menu-entry" | ||
role="presentation" | ||
custom-hover="true" | ||
> | ||
<a | ||
class="action-label codicon codicon-refresh" | ||
role="button" | ||
aria-label="Refresh Deployment Files" | ||
tabindex="0" | ||
></a> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div v-if="expanded" class="pane-body"> | ||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Nemo ad adipisci | ||
|
@@ -28,9 +55,76 @@ const expanded = defineModel("expanded", { required: false, default: false }); | |
defineProps<{ | ||
title: string; | ||
}>(); | ||
|
||
const toggleExpanded = () => { | ||
expanded.value = !expanded.value; | ||
}; | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.pane { | ||
.actions { | ||
display: none; | ||
margin-left: auto; | ||
|
||
.monaco-toolbar { | ||
height: 100%; | ||
|
||
.monaco-action-bar { | ||
white-space: nowrap; | ||
height: 100%; | ||
|
||
.actions-container { | ||
align-items: center; | ||
display: flex; | ||
height: 100%; | ||
margin: 0 auto; | ||
padding: 0; | ||
width: 100%; | ||
|
||
.action-item { | ||
display: block; | ||
cursor: pointer; | ||
position: relative; | ||
z-index: 2; | ||
margin-right: 4px; | ||
|
||
.action-label { | ||
border-radius: 5px; | ||
padding: 2px; | ||
font-size: 16px; | ||
align-items: center; | ||
display: flex; | ||
height: 20px; | ||
width: 20px; | ||
color: var(--vscode-icon-foreground); | ||
|
||
&:focus { | ||
opacity: 1; | ||
outline-color: var(--vscode-focusBorder); | ||
outline-offset: -1px; | ||
outline-style: solid; | ||
outline-width: 1px; | ||
} | ||
|
||
&:hover { | ||
background-color: var(--vscode-toolbar-hoverBackground); | ||
outline: 1px dashed var(--vscode-toolbar-hoverOutline); | ||
outline-offset: -1px; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
&.expanded:hover .actions, | ||
&.expanded:focus-within .actions { | ||
display: initial; | ||
} | ||
} | ||
|
||
.pane-header { | ||
line-height: 22px; | ||
color: var(--vscode-sideBarSectionHeader-foreground); | ||
|
@@ -40,31 +134,47 @@ defineProps<{ | |
align-items: center; | ||
cursor: pointer; | ||
display: flex; | ||
justify-content: space-between; | ||
font-size: 11px; | ||
font-weight: 700; | ||
height: 22px; | ||
overflow: hidden; | ||
|
||
.twisty-container { | ||
margin: 0 2px; | ||
font-size: 16px; | ||
color: var(--vscode-icon-foreground); | ||
&:focus { | ||
opacity: 1; | ||
outline-color: var(--vscode-focusBorder); | ||
outline-offset: -1px; | ||
outline-style: solid; | ||
outline-width: 1px; | ||
} | ||
|
||
.pane-header-title-container { | ||
display: flex; | ||
flex: 1; | ||
align-items: center; | ||
|
||
.twisty-container { | ||
margin: 0 2px; | ||
font-size: 16px; | ||
color: var(--vscode-icon-foreground); | ||
} | ||
|
||
.title { | ||
font-size: 11px; | ||
min-width: 3ch; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
text-transform: uppercase; | ||
white-space: nowrap; | ||
user-select: none; | ||
-webkit-margin-before: 0; | ||
-webkit-margin-after: 0; | ||
} | ||
} | ||
} | ||
|
||
.pane-body { | ||
flex: 1; | ||
overflow: hidden; | ||
} | ||
|
||
.title { | ||
font-size: 11px; | ||
min-width: 3ch; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
text-transform: uppercase; | ||
white-space: nowrap; | ||
-webkit-margin-before: 0; | ||
-webkit-margin-after: 0; | ||
} | ||
</style> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes it so ONLY the
pane-header
listens forkeydown.enter
otherwise focus on the children would have caused the toggle.