-
Notifications
You must be signed in to change notification settings - Fork 10
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
Conversation
Size stats
|
Deploy preview for mistica-web ready! ✅ Preview Built with commit a24796c. |
Accessibility report ℹ️ You can run this locally by executing |
Screenshot tests report ✔️ All passing |
}, | ||
backgroundColor: { | ||
control: {type: 'color'}, | ||
if: {arg: 'background', eq: 'color'}, |
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.
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)
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.
hmmm... how do you know you can use a color constant name there?, that's not intuitive at all
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.
I've tried something different, please take a look now
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
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.
That's perfect. To be picky maybe we could filter tokens with "text" to avoid that appearing in the list 🌝
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.
that would be tricky, which colors should we exclude/include?
src/card.tsx
Outdated
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.
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.
I think it should be fixed now
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.
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.
fixed
<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" />; |
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.
these are valid usage examples
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
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.
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.
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
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.
.../poster-card-screenshot-test-tsx-poster-card-with-custom-background-color-inverse-1-snap.png
Outdated
Show resolved
Hide resolved
<PosterCard title="title" />; | ||
// @ts-expect-error if you set a custom backgroundColor, you should specify the variant |
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.
Why not using a default value for the variant if it's not provided?
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.
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
)
# [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))
🎉 This PR is included in version 14.20.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
WEB-1498