Skip to content

Commit

Permalink
fix(Box): remove js check that allows brand token for Box backgroundC…
Browse files Browse the repository at this point in the history
…olor (#2457)

* fix: remove js check that allows brand token for Box backgroundColor

* Create mean-guests-reflect.md

* update test

* fix: update snapshot

---------

Co-authored-by: saurabhdaware <[email protected]>
  • Loading branch information
chaitanyadeorukhkar and saurabhdaware authored Feb 11, 2025
1 parent df06f31 commit 9dda151
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/mean-guests-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@razorpay/blade": patch
---

fix: remove js check that allows brand token for Box backgroundColor
3 changes: 1 addition & 2 deletions packages/blade/src/components/Box/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ const validateBackgroundString = (stringBackgroundColorValue: string): void => {
if (__DEV__) {
if (
!stringBackgroundColorValue.startsWith('surface.background') &&
!stringBackgroundColorValue.startsWith('brand.') &&
!stringBackgroundColorValue.startsWith('overlay.') &&
stringBackgroundColorValue !== 'transparent'
) {
throwBladeError({
message: `Oops! Currently you can only use \`transparent\`, \`surface.background.*\`, \`overlay.*\` and \`brand.*\` tokens with backgroundColor property but we received \`${stringBackgroundColorValue}\` instead.\n\n Do you have a usecase of using other values? Create an issue on https://github.com/razorpay/blade repo to let us know and we can discuss ✨`,
message: `Oops! Currently you can only use \`transparent\`, \`surface.background.*\`, and \`overlay.*\` tokens with backgroundColor property but we received \`${stringBackgroundColorValue}\` instead.\n\n Do you have a usecase of using other values? Create an issue on https://github.com/razorpay/blade repo to let us know and we can discuss ✨`,
moduleName: 'Box',
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('<Box />', () => {
);
} catch (err: unknown) {
expect(err).toMatchInlineSnapshot(`
[Error: [Blade: Box]: Oops! Currently you can only use \`transparent\`, \`surface.background.*\`, \`overlay.*\` and \`brand.*\` tokens with backgroundColor property but we received \`red\` instead.
[Error: [Blade: Box]: Oops! Currently you can only use \`transparent\`, \`surface.background.*\`, and \`overlay.*\` tokens with backgroundColor property but we received \`red\` instead.
Do you have a usecase of using other values? Create an issue on https://github.com/razorpay/blade repo to let us know and we can discuss ✨]
`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('<Box />', () => {
);
} catch (err: unknown) {
expect(err).toMatchInlineSnapshot(`
[Error: [Blade: Box]: Oops! Currently you can only use \`transparent\`, \`surface.background.*\`, \`overlay.*\` and \`brand.*\` tokens with backgroundColor property but we received \`red\` instead.
[Error: [Blade: Box]: Oops! Currently you can only use \`transparent\`, \`surface.background.*\`, and \`overlay.*\` tokens with backgroundColor property but we received \`red\` instead.
Do you have a usecase of using other values? Create an issue on https://github.com/razorpay/blade repo to let us know and we can discuss ✨]
`);
Expand Down

0 comments on commit 9dda151

Please sign in to comment.