Skip to content

Commit 9dda151

Browse files
fix(Box): remove js check that allows brand token for Box backgroundColor (#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 <saurabh.daware@razorpay.com>
1 parent df06f31 commit 9dda151

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

.changeset/mean-guests-reflect.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@razorpay/blade": patch
3+
---
4+
5+
fix: remove js check that allows brand token for Box backgroundColor

packages/blade/src/components/Box/Box.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ const validateBackgroundString = (stringBackgroundColorValue: string): void => {
1313
if (__DEV__) {
1414
if (
1515
!stringBackgroundColorValue.startsWith('surface.background') &&
16-
!stringBackgroundColorValue.startsWith('brand.') &&
1716
!stringBackgroundColorValue.startsWith('overlay.') &&
1817
stringBackgroundColorValue !== 'transparent'
1918
) {
2019
throwBladeError({
21-
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 ✨`,
20+
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 ✨`,
2221
moduleName: 'Box',
2322
});
2423
}

packages/blade/src/components/Box/__tests__/Box.native.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe('<Box />', () => {
6161
);
6262
} catch (err: unknown) {
6363
expect(err).toMatchInlineSnapshot(`
64-
[Error: [Blade: Box]: Oops! Currently you can only use \`transparent\`, \`surface.background.*\`, \`overlay.*\` and \`brand.*\` tokens with backgroundColor property but we received \`red\` instead.
64+
[Error: [Blade: Box]: Oops! Currently you can only use \`transparent\`, \`surface.background.*\`, and \`overlay.*\` tokens with backgroundColor property but we received \`red\` instead.
6565
6666
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 ✨]
6767
`);

packages/blade/src/components/Box/__tests__/Box.web.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe('<Box />', () => {
7171
);
7272
} catch (err: unknown) {
7373
expect(err).toMatchInlineSnapshot(`
74-
[Error: [Blade: Box]: Oops! Currently you can only use \`transparent\`, \`surface.background.*\`, \`overlay.*\` and \`brand.*\` tokens with backgroundColor property but we received \`red\` instead.
74+
[Error: [Blade: Box]: Oops! Currently you can only use \`transparent\`, \`surface.background.*\`, and \`overlay.*\` tokens with backgroundColor property but we received \`red\` instead.
7575
7676
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 ✨]
7777
`);

0 commit comments

Comments
 (0)