Skip to content
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 collapsible card #35

Merged
merged 7 commits into from
Nov 17, 2021
Merged

add collapsible card #35

merged 7 commits into from
Nov 17, 2021

Conversation

eunicekokor
Copy link
Contributor

@eunicekokor eunicekokor commented Nov 16, 2021

closes https://github.com/Arize-ai/arize/issues/7048
using Accordion as a reference https://github.com/Arize-ai/ui-components/blob/3b88026be755c7e4ea6d1485f9a0c1cf68fe86ef/src/accordion/Accordion.tsx

wasn't sure how much to split into a new component, similar to Tabbed card, or if we could leverage existing Card

Screen Shot 2021-11-16 at 9 36 23 AM

https://user-images.githubusercontent.com/5273390/142048104-37c789ba-f98a-4fce-bb04-7657f4b15f8f.mov

pending:

  • Design suggestions from @theandylu on gallery
    • icon margin-right 8
    • w/ subtitle "the arrow needs to be attached to the group and not just title"

@github-actions
Copy link

github-actions bot commented Nov 16, 2021

size-limit report 📦

Path Size
dist/components.cjs.production.min.js 50.69 KB (+1.15% 🔺)
dist/components.esm.js 36.56 KB (+1.75% 🔺)

src/card/Card.tsx Outdated Show resolved Hide resolved
src/card/Card.tsx Outdated Show resolved Hide resolved
src/card/Card.tsx Outdated Show resolved Hide resolved
src/card/Card.tsx Outdated Show resolved Hide resolved
css={cardCSS}
css={
collapsible
? collapsibleCardCSS({ cardHeight: cardHeaderHeight })
Copy link
Collaborator

Choose a reason for hiding this comment

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

why does the card header height need to be passed in if it never changes?

Copy link
Contributor Author

@eunicekokor eunicekokor Nov 16, 2021

Choose a reason for hiding this comment

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

since the header and the card will share the same height in collapsed position, wanted to keep it explicit that they were linked.
If you prefer it not to be passed in, let me know if there's a better strategy for this, using a theme value perhaps?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see. So this is actually just the card header height that it shrinks too. In that case I would just remove the parameter and make it a variable in the styles.js - as is it's confusing since it makes it seem as though something is configurable

src/card/Card.tsx Outdated Show resolved Hide resolved
src/card/CardAccordionButton.tsx Outdated Show resolved Hide resolved
src/card/CardAccordionButton.tsx Outdated Show resolved Hide resolved
src/card/Card.tsx Show resolved Hide resolved
Copy link
Collaborator

@mikeldking mikeldking left a comment

Choose a reason for hiding this comment

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

LGTM! Can you do a chromatic build for a quick visual check?

src/card/Card.tsx Outdated Show resolved Hide resolved
css={cardCSS}
css={
collapsible
? collapsibleCardCSS({ cardHeight: cardHeaderHeight })
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see. So this is actually just the card header height that it shrinks too. In that case I would just remove the parameter and make it a variable in the styles.js - as is it's confusing since it makes it seem as though something is configurable

}
/* required to override any passed in height values in a closed state */
&:not(.is-open) {
height: ${cardHeight}px !important;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
height: ${cardHeight}px !important;
/* shrink the height to the card title so the body is hidden*/
height: ${cardTitleHeight}px !important;

@@ -31,3 +31,41 @@ export const headerCSS = ({
height: ${height}px;
${bordered ? headerBorderCSS : ''}
`;

export const collapsibleCardCSS = ({
cardHeight,
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need to pass this in since it's not actually configurable.

@eunicekokor
Copy link
Contributor Author

Copy link
Collaborator

@mikeldking mikeldking left a comment

Choose a reason for hiding this comment

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

🥳

@eunicekokor eunicekokor merged commit 9fecde9 into main Nov 17, 2021
@eunicekokor eunicekokor deleted the collapsibleCard branch November 17, 2021 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants