Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

feat: LEAP-336: Collapsible cards in Ranker #1612

Merged
merged 5 commits into from
Nov 10, 2023

Conversation

hlomzik
Copy link
Collaborator

@hlomzik hlomzik commented Nov 7, 2023

Allow to collapse and expand cards for easy interactions. With collapsed cards user can see lot of items together with makes rearrangement easier.

Collapsed/expanded states are indicated by ASCII triangles (△/▽ and ▲/▼ for hovered state) used in css to change only class names, not the content and to keep indicators in one place.

Collapse is desirable action so column is treated as expanded when at least one item is expanded. This allows to collapse all items in any state by one click.

New hidden parameter added to Ranker: collapsible with default true to allow to disable this functionality if it's not needed for any reason.

PR fulfills these requirements

  • Tests for the changes have been added/updated (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • Best efforts were made to ensure docs/code are concise and coherent (checked for spelling/grammatical errors, commented out code, debug logs etc.)
  • Self-reviewed and ran all changes on a local instance (for bug fixes/features)

What libraries were added/updated?

none

Does this change affect performance?

nope

Does this change affect security?

nope

What alternative approaches were there?

Cards can be made hidden with animation to not change the content inside, but this will require calculations of their height.

What feature flags were used to cover this change?

none yet

Does this PR introduce a breaking change?

  • Yes, and covered entirely by feature flag(s)
  • Yes, and covered partially by feature flag(s)
  • No
  • Not sure (briefly explain the situation below)

What level of testing was included in the change?

(check all that apply)

  • e2e
  • integration
  • unit

Which logical domain(s) does this change affect?

Ranker

Screenshot 2023-11-07 at 16 14 40

@codecov-commenter
Copy link

codecov-commenter commented Nov 7, 2023

Codecov Report

Attention: 14 lines in your changes are missing coverage. Please review.

Files Coverage Δ
src/components/NewTaxonomy/NewTaxonomy.tsx 87.50% <100.00%> (+0.22%) ⬆️
src/components/NewTaxonomy/TaxonomySearch.tsx 85.71% <100.00%> (ø)
src/components/Ranker/Column.tsx 11.11% <0.00%> (-8.89%) ⬇️
src/components/Ranker/Item.tsx 7.69% <0.00%> (-3.42%) ⬇️
src/components/Ranker/Ranker.tsx 5.40% <16.66%> (+2.17%) ⬆️

📢 Thoughts on this report? Let us know!

}

button span::after {
content: '△';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this functions just fine but it may look better if we use icons instead - can Design provide icons? or do you want to pull in React icons much like we have in DM2 and LSP

Copy link
Contributor

@yyassi-heartex yyassi-heartex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved but i have a optional suggestion to use icons like react-icons or icons provided by design for better visuals

This will allow to disable collapsible items if they are
not a good fit for any reason.
Fix styles to be applied only when it's true.
@hlomzik hlomzik force-pushed the fb-leap-336/collapsible-card branch from 4aa886d to 7f9d6ad Compare November 10, 2023 00:45
@hlomzik hlomzik merged commit da3030a into master Nov 10, 2023
15 checks passed
@hlomzik hlomzik deleted the fb-leap-336/collapsible-card branch November 10, 2023 16:24
MasherJames pushed a commit to HelloPareto/label-studio-frontend that referenced this pull request Feb 29, 2024
* feat: LEAP-336: Make Ranker cards collapsible

First try with just collapsible items, no design, via react context.

* Move styling and hiding to styles

* Collapse/Expand All in column titles

* Add param `collapsible` default to true

This will allow to disable collapsible items if they are
not a good fit for any reason.
Fix styles to be applied only when it's true.

* Change default styles; better to be more universal by default
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants