Skip to content

Commit

Permalink
Merge pull request #2293 from posit-dev/dotnomad/tree-section-count
Browse files Browse the repository at this point in the history
  • Loading branch information
dotNomad authored Sep 19, 2024
2 parents dbe6fe7 + 74f9ee1 commit 5165e8b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
28 changes: 28 additions & 0 deletions extensions/vscode/webviews/homeView/src/components/CountBadge.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<template>
<div class="count-badge">{{ count }}</div>
</template>

<script setup lang="ts">
defineProps<{
count: number;
}>();
</script>

<style lang="scss" scoped>
.count-badge {
background-color: var(--vscode-badge-background);
color: var(--vscode-badge-foreground);
border: 1px solid var(--vscode-badge-foreground);
border-radius: 11px;
box-sizing: border-box;
display: inline-block;
font-size: 11px;
font-weight: 400;
line-height: 11px;
min-height: 18px;
min-width: 18px;
padding: 3px 6px;
text-align: center;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
<div v-if="actions" class="actions">
<ActionToolbar :title="title" :actions="actions" />
</div>
<div v-if="count" class="count">
<CountBadge :count="count" />
</div>
</div>
<div v-show="expanded" class="pane-body">
<slot />
Expand All @@ -36,6 +39,7 @@

<script setup lang="ts">
import ActionToolbar, { ActionButton } from "src/components/ActionToolbar.vue";
import CountBadge from "src/components/CountBadge.vue";
const expanded = defineModel("expanded", { required: false, default: false });
Expand All @@ -44,6 +48,7 @@ defineProps<{
description?: string;
codicon?: string;
actions?: ActionButton[];
count?: number;
}>();
const toggleExpanded = () => {
Expand Down Expand Up @@ -141,6 +146,12 @@ const toggleExpanded = () => {
& :deep(.action-item) {
margin-right: 4px;
}
.count {
display: flex;
margin-left: 2px;
padding-right: 12px;
}
}
.pane-body {
Expand Down

0 comments on commit 5165e8b

Please sign in to comment.