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

new(Card): Adding two props 'noShadow' and 'selected' for Card #396

Merged
merged 3 commits into from
Aug 4, 2020

Conversation

monicapharm
Copy link
Contributor

to: @williaster @alecklandgraf

Description

Add two new props for the Card component.

  1. noShadow that hides the shadow of the card.
  2. selected that shows the border when selected.

Motivation and Context

Background:
Some discussions are here https://git.musta.ch/airbnb/solar/issues/978, the design team call out for adding a new variation 'noShadow' for Card to support some features like the wrapper of checkboxes.

And in the long run, looks like the Lunar team also consider to refactor clickable button checkboxes to just being wrapped with card, so also adding the selected state here in this PR.

Design: figma
image

Testing

Local storybook and unit tests.

Screenshots

When there is noShadow:
image

When selected:
image

Checklist

  • My code follows the style guide of this project.
  • I have updated or added documentation accordingly.
  • I have read the CONTRIBUTING document.

@airbnb-bot
Copy link
Collaborator

airbnb-bot commented Jul 29, 2020

Size Changes

Package Diff ESM Prev ESM CJS Prev CJS
core +0.0% 567.24 KB 566.97 KB 709.35 KB 709.05 KB

Compared to master. File sizes are unminified and ungzipped.

View raw build stats

Previous (master)

{
  "apollo": {
    "esm": 10832,
    "lib": 14147
  },
  "app-shell": {
    "esm": 12906,
    "lib": 19874
  },
  "composer": {
    "esm": 68247,
    "lib": 101805
  },
  "core": {
    "esm": 580573,
    "lib": 726065
  },
  "forms": {
    "esm": 37350,
    "lib": 49298
  },
  "icons": {
    "esm": 156355,
    "lib": 205626
  },
  "layouts": {
    "esm": 15298,
    "lib": 20770
  },
  "metrics": {
    "esm": 5467,
    "lib": 7729
  },
  "test-utils": {
    "esm": 4279,
    "lib": 5937
  }
}

Current

{
  "apollo": {
    "esm": 10832,
    "lib": 14147
  },
  "app-shell": {
    "esm": 12906,
    "lib": 19874
  },
  "composer": {
    "esm": 68247,
    "lib": 101805
  },
  "core": {
    "esm": 580852,
    "lib": 726374
  },
  "forms": {
    "esm": 37350,
    "lib": 49298
  },
  "icons": {
    "esm": 156355,
    "lib": 205626
  },
  "layouts": {
    "esm": 15298,
    "lib": 20770
  },
  "metrics": {
    "esm": 5467,
    "lib": 7729
  },
  "test-utils": {
    "esm": 4279,
    "lib": 5937
  }
}

@monicapharm
Copy link
Contributor Author

2 added in Happo report:

image

@monicapharm
Copy link
Contributor Author

@williaster @alecklandgraf PTAL when you got a chance. : )

Copy link
Contributor

@williaster williaster left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, I think this has a couple issues we should fix before landing.

packages/core/src/components/Card/styles.ts Outdated Show resolved Hide resolved
return (
<div
className={cx(
!noShadow && styles.card,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the way you've written this breaks the component. styles.card sets

  • pattern.box (border/boxShadow/borderRadius)
  • backgroundColor
  • overflow

and your styles.card_noShadow only applies border and ignores the rest. it seems like we could always apply styles.card, and re-define card_noShadow to only override boxShadow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! :)

@monicapharm monicapharm requested a review from williaster August 4, 2020 00:44
@monicapharm monicapharm force-pushed the mma-add-card-styles branch from de80436 to 818b6ad Compare August 4, 2020 03:29
@monicapharm
Copy link
Contributor Author

@williaster Do you know why the pull request CI failed? looks like it's not related to my change 🤔

@williaster
Copy link
Contributor

happo has been flaky recently 😞 re-running them.

@monicapharm monicapharm requested a review from williaster August 4, 2020 22:36
@monicapharm
Copy link
Contributor Author

Re-run the CI a couple of times, finally got them passed 😄 @williaster PTAL

Copy link
Contributor

@williaster williaster left a comment

Choose a reason for hiding this comment

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

woot! lgtm, thanks for the iteration and patience with CI

@williaster williaster merged commit a57ae8e into master Aug 4, 2020
@williaster williaster deleted the mma-add-card-styles branch August 4, 2020 23:08
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.

3 participants