-
Notifications
You must be signed in to change notification settings - Fork 142
Card Stack ticks all by default #2793
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
Card Stack ticks all by default #2793
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2793 +/- ##
==========================================
+ Coverage 71.75% 71.83% +0.07%
==========================================
Files 134 134
Lines 7314 7331 +17
Branches 1521 1502 -19
==========================================
+ Hits 5248 5266 +18
- Misses 1938 2019 +81
+ Partials 128 46 -82 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Perhaps we can make the Otherwise, we can do the opposite, by supporting a way to disable the select all button |
|
@MoshiMoshiMochi If there are non-trivial UX changes, also provide screenshots of those changes. |
|
Hi @gerteck & @damithc are these changes something similar to what you had in mind?
See Demo Example 1 (On the functionality of Select All)e.g. serving this example <frontmatter>
layout: default.md
title: Hello World
pageNav: 1
pageNavTitle: "Chapters of This Page"
</frontmatter>
<cardstack searchable>
<card header="**Winston Churchil**" tag="Success, Perseverance" disable=true>
Success is not final, failure is not fatal: it is the courage to continue that counts
</card>
<card header="**Albert Einstein**" tag="Success, Perseverance" disabled=true>
In the middle of every difficulty lies opportunity
</card>
<card header="**Theodore Roosevelt**" tag="Motivation, Hard Work">
Do what you can, with what you have, where you are
</card>
<card header="**Steve Jobs**" tag="Happiness, Mindset">
Your time is limited, so don’t waste it living someone else’s life
</card>
</cardstack>
Hello worldSee Demo Example 2 (On showing/hiding the select all tag)e.g. serving this example <frontmatter>
layout: default.md
title: Hello World
pageNav: 1
pageNavTitle: "Chapters of This Page"
</frontmatter>
<cardstack searchable show-select-all="FaLsE">
<card header="**Winston Churchil**" tag="Success, Perseverance">
Success is not final, failure is not fatal: it is the courage to continue that counts
</card>
<card header="**Albert Einstein**" tag="Success, Perseverance">
In the middle of every difficulty lies opportunity
</card>
<card header="**Theodore Roosevelt**" tag="Motivation, Hard Work">
Do what you can, with what you have, where you are
</card>
<card header="**Steve Jobs**" tag="Happiness, Mindset">
Your time is limited, so don’t waste it living someone else’s life
</card>
</cardstack>
<cardstack searchable>
<card header="**Winston Churchil**" tag="Success, Perseverance">
Success is not final, failure is not fatal: it is the courage to continue that counts
</card>
<card header="**Albert Einstein**" tag="Success, Perseverance">
In the middle of every difficulty lies opportunity
</card>
<card header="**Theodore Roosevelt**" tag="Motivation, Hard Work">
Do what you can, with what you have, where you are
</card>
<card header="**Steve Jobs**" tag="Happiness, Mindset">
Your time is limited, so don’t waste it living someone else’s life
</card>
</cardstack>
Hello world
|
|
@MoshiMoshiMochi I think the |
Noted will get to work on that! |
|
Hi Prof @damithc! I've set the I've also experimented using a linear gradient. This could possibly be another way of making it stand out further since all other toggle badges use a single color. I also tried experimenting with radial/conic gradients but I couldn't really come up with something that I felt blended in with the current design.
2. Linear Gradient fading in and out and in
Do let me know if this is something you had in mind (, which option you prefer), and/or if there are other styling options/ideas you would like me to experiment/proceed with. |
@MoshiMoshiMochi I like the first one but let's go without the border. I think no need for bold either. If possible, experiment putting the tick box on the left of the text for |
|
Hi prof @damithc! As requested I have experimented with removing the bold, border and also by moving the checkbox to the left. Here is the checkbox on the right like usual for comparison. I also tried experimenting with moving all the individual tags to the second row, while keeping the first row for the Kindly let me know if this is something you had in mind (, which option you prefer), and once more if there are other styling options/ideas you would like me to further experiment/proceed with. |
|
@MoshiMoshiMochi I prefer the first one. It still looks bold. Likely the UI control used is using bold by default. You may have to explicitly use non-bold. Separately, I'm wondering if we should auto-omit the select-all if there are fewer than N tags (e.g., 3). This can be a separate PR though. |
|
Hi prof @damithc! Kindly view the changes below, I've explicitly set the font weight for the select all to be normal. Do let me know if this is what you had in mind.
Yep sounds like a great idea! The current design already checks the length of the |
Looks good. Let's go with this one.
Let's set it to |
|
Hi prof @damithc! I've made the changes as requested. From the example below, we can see that while both cardstacks have 3 cards, the cardstack below only has 3 tags and therefore the e.g. serving this file <frontmatter>
layout: default.md
title: Hello World
pageNav: 1
pageNavTitle: "Chapters of This Page"
</frontmatter>
<cardstack searchable>
<card header="**Winston Churchil**" tag="Success, Perseverance">
Success is not final, failure is not fatal: it is the courage to continue that counts
</card>
<card header="**Albert Einstein**" tag="Success, Perseverance">
In the middle of every difficulty lies opportunity
</card>
<card header="**Theodore Roosevelt**" tag="Motivation, Hard Work">
Do what you can, with what you have, where you are
</card>
</cardstack>
<cardstack searchable>
<card header="**Winston Churchil**" tag="Success, Perseverance">
Success is not final, failure is not fatal: it is the courage to continue that counts
</card>
<card header="**Albert Einstein**" tag="Success, Perseverance">
In the middle of every difficulty lies opportunity
</card>
<card header="**Theodore Roosevelt**" tag="Motivation">
Do what you can, with what you have, where you are
</card>
</cardstack>
Hello world
|
damithc
left a comment
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.
The current UX looks good, @MoshiMoshiMochi
No further comments (on the UX aspect) from me.
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.
Pull request overview
This PR updates the cardstack component so that tags are selected by default, adds a “Select All” control, wires it through the Markdown/HTML processing pipeline, and documents the new behavior.
Changes:
- Frontend:
CardStack.vuenow initializes all tags as selected on load, adds an optional “Select All” badge that can toggle all tags, and changes the behavior so that unselecting all tags hides all cards instead of showing all. - Core processing:
MdAttributeRendererandNodeProcessornow normalize and pass through ashow-select-allattribute on<cardstack>elements, treating any non-"false"value astrueand supporting case-insensitive input. - Tests & docs: Added/updated Jest tests for
CardStackbehavior andshow-select-allstandardization, updated snapshots, and extended the user guide (cardstacks.md) to documentshow-select-alland to correctdisable→disabled.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
packages/vue-components/src/cardstack/CardStack.vue |
Implements default selection of all tags, the showSelectAll prop, the Select All badge UI, and updated tag filtering logic (showAllTags, toggleAllTags). |
packages/vue-components/src/__tests__/CardStack.spec.js |
Adds tests for default tag selection, Select All toggle behavior, visibility thresholds, and show-select-all prop handling; one test’s assertion currently doesn’t validate card hiding as intended. |
packages/vue-components/src/__tests__/__snapshots__/CardStack.spec.js.snap |
Updates snapshots to reflect the new Select All v-if block and the initial checkmark on tag badges. |
packages/core/src/html/NodeProcessor.ts |
Routes <cardstack> nodes through MdAttributeRenderer.processCardStackAttributes during preprocessing. |
packages/core/src/html/MdAttributeRenderer.ts |
Adds processCardStackAttributes to normalize show-select-all values on <cardstack> nodes, using lodash isNil. |
packages/core/test/unit/html/NodeProcessor.test.ts |
Adds a unit test to verify processNode normalizes cardstack show-select-all attributes (fAlSe → false, other values → true, absent → undefined). |
docs/userGuide/syntax/cardstacks.md |
Documents the new show-select-all option and corrects the card option name from disable to disabled. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
gerteck
left a comment
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.
thanks for working on this, highlighted some changes!
gerteck
left a comment
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.
LGTM, just need you to remove the commented out code
do you intend to shift the fuzzy boolean logic to the vue component? Or do away with it entirely? either should be ok
gerteck
left a comment
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.
lgtm












What is the purpose of this pull request?
resolves #2781
Overview of changes:
show-select-allflag as an optional cardstack (defaults to true) & updated the user guide documentation accordingly.Anything you'd like to highlight/discuss:
cardStackRef.tagMappingto ensure that once the<card>components register their tags, that the parent automatically adds them toselectedTags. SinceselectedTagsis now populated on load, all tags appear checked to begin with.2.1 It can be used to toggle all tags to clear/select all tags in
2.2 It syncs with all the selected tags, meaning that unchecking a single tag automatically unchecks "Select All". This is to better signify that not all tags have been selected.
showAllTags(showTag)to accept a boolean. It now serves as a master switch to loop through all child cards and set their disableTag state to either true (visible) or false (hidden).updateTagso that unchecking all cards now displays no other cards. Previously doing so would automatically display all cards again.See Demo Example 1 (On the functionality of Select All)
e.g. serving this example
See Demo Example 2 (On showing/hiding the select all tag)
e.g. serving this example
UserGuide error? (Resolved)
Shouldn't
disablebedisabled? See demo example above for reference. Kindly let me know if I'm mistaken or if I should go ahead and fix this since its so small.markbind/docs/userGuide/syntax/cardstacks.md
Lines 138 to 153 in ca4a65b
Testing instructions:
Proposed commit message: (wrap lines at 72 characters)
Update Card Stack to tick all tags by default
Checklist: ☑️
Reviewer checklist:
Indicate the SEMVER impact of the PR:
At the end of the review, please label the PR with the appropriate label:
r.Major,r.Minor,r.Patch.Breaking change release note preparation (if applicable):