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

feat(PosterCard): allow backgroundColor/variant #841

Merged
merged 12 commits into from
Aug 11, 2023

Conversation

atabel
Copy link
Collaborator

@atabel atabel commented Aug 3, 2023

@github-actions
Copy link

github-actions bot commented Aug 3, 2023

Size stats

master this branch diff
Total JS 9.42 MB 9.42 MB +513 B
JS without icons 914 kB 915 kB +513 B
Lib overhead 127 kB 127 kB 0 B
Lib overhead (gzip) 32.9 kB 32.9 kB 0 B

@github-actions
Copy link

github-actions bot commented Aug 3, 2023

Deploy preview for mistica-web ready!

✅ Preview
https://mistica-7foeug3nv-tuentisre.vercel.app

Built with commit a24796c.
This pull request is being automatically deployed with vercel-action

@github-actions
Copy link

github-actions bot commented Aug 3, 2023

Accessibility report
✔️ No issues found

ℹ️ You can run this locally by executing yarn audit-accessibility.

@atabel atabel marked this pull request as ready for review August 11, 2023 06:52
@github-actions
Copy link

github-actions bot commented Aug 11, 2023

Screenshot tests report

✔️ All passing

},
backgroundColor: {
control: {type: 'color'},
if: {arg: 'background', eq: 'color'},
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the solution that was implemented by vivo
https://mistica-a10w6pvfo-tuentisre.vercel.app/?path=/story/components-cards-poster-card--default

You can fill to this field some hex value (#FFF) or a constant (backgroundBrandSecondary) instead of color picker. (From the design side, when possible, always try to use constants and not hex values)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hmmm... how do you know you can use a color constant name there?, that's not intuitive at all

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've tried something different, please take a look now

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

Choose a reason for hiding this comment

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

That's perfect. To be picky maybe we could filter tokens with "text" to avoid that appearing in the list 🌝

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that would be tricky, which colors should we exclude/include?

src/card.tsx Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment that @aweell said in the other PR. When the card doesn't have image or video and inverse is false, the hover should be the same or similar to row list hover or the rest of white background component hovers.

https://www.figma.com/file/tKdPOfcUALzVIh5oizFbm7/%F0%9F%94%B8-Cards-Specs?type=design&node-id=2094-7031&mode=design&t=UXAJ8MkmcdI5ik8a-4

@aweell maybe it is not too clear in specs, two teams overlooked it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it should be fixed now

Copy link
Contributor

Choose a reason for hiding this comment

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

The background now work fine, but the top actions states also need to change depending if the background is media or no media variant="inverse", no media variant="default/alternative".

Screenshot 2023-08-11 at 11 19 48

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@yceballost
Copy link
Contributor

Screenshot tests report

❌ poster-card / poster-card-with-video

I had the same problem yesterday with that screenshot 🤔

@atabel
Copy link
Collaborator Author

atabel commented Aug 11, 2023

Screenshot tests report
x poster-card / poster-card-with-video

I had the same problem yesterday with that screenshot thinking

This test seems unstable

@atabel atabel requested a review from yceballost August 11, 2023 09:18
Comment on lines +34 to +38
<PosterCard title="title" isInverse />;
<PosterCard title="title" variant="inverse" />;
<PosterCard title="title" variant="alternative" />;
<PosterCard title="title" isInverse backgroundColor="red" />;
<PosterCard title="title" variant="inverse" backgroundColor="red" />;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

these are valid usage examples

Copy link
Contributor

@aweell aweell left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

Choose a reason for hiding this comment

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

This card is impossible to have in dark mode. ThemeVariant is forcing these text to white :( I think that could be a problem. Can we force themeVariant also in dark mode?
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is tricky because Text just uses textPrimary/textPrimaryInverse depending on the variant context, but those color constants are both white in dark mode. So the only way to fix this would be to find a way to disable dark mode in this area. We could explore a solution in a different PR to manage this case

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@atabel atabel mentioned this pull request Aug 11, 2023
<PosterCard title="title" />;
// @ts-expect-error if you set a custom backgroundColor, you should specify the variant
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not using a default value for the variant if it's not provided?

Copy link
Collaborator Author

@atabel atabel Aug 11, 2023

Choose a reason for hiding this comment

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

I think I prefer this to be explicit. You set either backgroundImage, backgroundColor or backgroundVideo. backgroundColor can be set explicitly with a custom color (backgroundColor="red") or implicitly using an specific variant (variant="inverse" or isInverse)

@yceballost yceballost self-requested a review August 11, 2023 13:14
@atabel atabel added this pull request to the merge queue Aug 11, 2023
Merged via the queue into master with commit f8e1f37 Aug 11, 2023
10 checks passed
@atabel atabel deleted the atoledano-poster-card-background branch August 11, 2023 13:40
tuentisre pushed a commit that referenced this pull request Aug 11, 2023
# [14.20.0](v14.19.0...v14.20.0) (2023-08-11)

### Bug Fixes

* **AdvancedDataCard:** avoid content overflow with top actions ([#839](#839)) ([a1eae2d](a1eae2d))
* **AdvancedDataCard:** Fix Touchable layout, extras positioning, closable DOM position... ([#833](#833)) ([21dea84](21dea84))
* **AdvancedDataCard:** touchable area didn't cover the whole card in some cases ([#847](#847)) ([31ec606](31ec606))
* **ButtonLink:** add aligned prop back until next major release ([#846](#846)) ([3de841c](3de841c))
* **Tabs:** style fixes and align with design spec ([#832](#832)) ([37de417](37de417))

### Features

* **ButtonLink:** scale chevron according to font size ([#849](#849)) ([b69b651](b69b651))
* **Icons:** new Subtract icons ([#845](#845)) ([5f0a5f0](5f0a5f0))
* **NakedCard:** add support for top icon ([#836](#836)) ([f438079](f438079))
* **PosterCard:** allow backgroundColor/variant ([#841](#841)) ([f8e1f37](f8e1f37))
* **Row,BoxedRow:** add pressed style to list rows ([#838](#838)) ([8437198](8437198))
* **skin:** update design tokens ([#851](#851)) ([544f812](544f812))
* **SnapCard, DataCard, DisplayDataCard:** add aspect ratio support ([#848](#848)) ([b3e1639](b3e1639))
* **Title:** add tokens for Title2 and create Title3 ([#835](#835)) ([e218ba1](e218ba1))
@tuentisre
Copy link
Collaborator

🎉 This PR is included in version 14.20.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants