-
Notifications
You must be signed in to change notification settings - Fork 203
[CLOVER-399][BpkText] Add color prop to improve overrides #3873
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
Conversation
Visit https://backpack.github.io/storybook-prs/3873 to see this build running in a browser. |
Visit https://backpack.github.io/storybook-prs/3873 to see this build running in a browser. |
[rest: string]: any; | ||
}; | ||
|
||
const BpkText = ({ | ||
children, | ||
className = null, | ||
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.
The color set to empty by default is get ride of update snapshots anywhere even there are no color passed.
Visit https://backpack.github.io/storybook-prs/3873 to see this build running in a browser. |
Visit https://backpack.github.io/storybook-prs/3873 to see this build running in a browser. |
Visit https://backpack.github.io/storybook-prs/3873 to see this build running in a browser. |
Visit https://backpack.github.io/storybook-prs/3873 to see this build running in a browser. |
@@ -92,10 +94,13 @@ const BpkText = ({ | |||
className, | |||
); | |||
|
|||
const { style, ...otherProps } = rest; |
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.
the reason why extract style here because we don't want to expose style as prop to consumer, if extract as color and tagName, it would expose style in readme.
const { style, ...otherProps } = rest; | ||
const computedStyles = { ...style, ...(color ? { 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.
it use computedStyles which combine from style and color, in case consumer use style to override would not work anymore.
Visit https://backpack.github.io/storybook-prs/3873 to see this build running in a browser. |
Visit https://backpack.github.io/storybook-prs/3873 to see this build running in a browser. |
Context
BpkText’s lack of default or token-based color support leads to widespread manual style overrides (average 14.88% per major page), undermining VDL consistency and reducing design system reliability and maintainability across Skyscanner products.
We want to add color prop so that consumer can change BpkText color by config but not override.
Changes
color
toBpkText
Remember to include the following changes:
[Clover-123][BpkButton] Updating the colour
README.md
(If you have created a new component)README.md