Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ exports[`CardStack markdown in header, content 1`] = `

</div>
</div>
<div
class="results-count"
>
0 result
</div>
</div>
`;

Expand Down Expand Up @@ -202,6 +207,11 @@ exports[`CardStack should not hide cards when no filter is provided 1`] = `

</div>
</div>
<div
class="results-count"
>
1 result
</div>
</div>
`;

Expand Down Expand Up @@ -281,5 +291,10 @@ exports[`CardStack should not hide cards when no filter is provided 2`] = `

</div>
</div>
<div
class="results-count"
>
0 result
</div>
</div>
`;
2 changes: 1 addition & 1 deletion packages/vue-components/src/cardstack/Card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default {
},
components: {
},
inject: ['cardStackRef'], // Inject the ref
inject: ['cardStackRef'],
computed: {
computedWidth() {
const block = this.$parent.$props.blocks;
Expand Down
25 changes: 13 additions & 12 deletions packages/vue-components/src/cardstack/CardStack.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<slot></slot>
</div>
</div>
<div class="results-count">
{{ matchingCardsCount }} result{{ matchingCardsCount > 1 ? 's' : '' }}
</div>
</div>
</template>

Expand Down Expand Up @@ -86,6 +89,9 @@ export default {
const hasEnoughTags = this.cardStackRef.tagMapping.length > MIN_TAGS_FOR_SELECT_ALL;
return isEnabled && hasEnoughTags;
},
matchingCardsCount() {
return this.cardStackRef.children.filter(child => !child.computeDisabled).length;
},
},
watch: {
'cardStackRef.tagMapping': {
Expand Down Expand Up @@ -242,18 +248,6 @@ export default {
max-width: 25.4em;
}

/* .tag-container {
display: flex;
flex-direction: row;
width: 50%;
text-align: right
} */

/* .tag-badge-container {
display: flex;
flex-flow: row wrap;
width: 100%;
} */
.tag-badge {
margin: 2px;
cursor: pointer;
Expand All @@ -275,4 +269,11 @@ export default {
.select-all-toggle .tag-indicator {
margin-right: 1.5px;
}

.results-count {
text-align: center;
margin-top: 15px;
color: #666;
font-size: 14px;
}
</style>