Skip to content

Commit

Permalink
feat(examples): add tokens usage demo (#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamleshchandnani authored Jul 29, 2021
1 parent 1aa2961 commit d8d8027
Show file tree
Hide file tree
Showing 41 changed files with 8,304 additions and 1,006 deletions.
5 changes: 5 additions & 0 deletions .changeset/spicy-taxis-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@razorpay/blade": patch
---

fix(blade): typo in color tokens
10 changes: 10 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version": "independent",
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
"bootstrap": {
"ignoreScripts": true
}
}
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
},
"scripts": {
"lint": "eslint --ext js,jsx,ts,tsx packages",
"release": "changeset publish"
"release": "changeset publish",
"postinstall": "lerna run --scope @razorpay/blade build"
},
"dependencies": {},
"devDependencies": {
"lerna": "4.0.0",
"@changesets/cli": "2.16.0",
"@types/jest": "26.0.23",
"@types/react": "17.0.4",
Expand Down
20 changes: 10 additions & 10 deletions packages/blade/src/tokens/global/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ const colors: Color = {
},
neutral: {
blueGrayLight: {
0: `hsla(0, 0, 100%, ${opacity[9]})`,
0: `hsla(0, 0%, 100%, ${opacity[9]})`,
50: `hsla(220, 27%, 98%, ${opacity[9]})`,
100: `hsla(220, 30%, 96%, ${opacity[9]})`,
200: `hsla(214, 21%, 94%, ${opacity[9]})`,
Expand All @@ -205,7 +205,7 @@ const colors: Color = {
a200: `hsla(216, 44%, 23%, ${opacity[3]})`,
},
blueGrayDark: {
0: `hsla(0, 0, 99%, ${opacity[9]})`,
0: `hsla(0, 0%, 99%, ${opacity[9]})`,
50: `hsla(215, 12%, 92%, ${opacity[9]})`,
100: `hsla(218, 11%, 84%, ${opacity[9]})`,
200: `hsla(218, 11%, 76%, ${opacity[9]})`,
Expand All @@ -226,7 +226,7 @@ const colors: Color = {
a200: `hsla(220, 11%, 84%, ${opacity[3]})`,
},
navyGrayLight: {
0: `hsla(0, 0, 100%, ${opacity[9]})`,
0: `hsla(0, 0%, 100%, ${opacity[9]})`,
50: `hsla(230, 27%, 98%, ${opacity[9]})`,
100: `hsla(230, 30%, 96%, ${opacity[9]})`,
200: `hsla(224, 21%, 94%, ${opacity[9]})`,
Expand All @@ -247,7 +247,7 @@ const colors: Color = {
a200: `hsla(226, 44%, 23%, ${opacity[3]})`,
},
navyGrayDark: {
0: `hsla(0, 0, 99%, ${opacity[9]})`,
0: `hsla(0, 0%, 99%, ${opacity[9]})`,
50: `hsla(228, 12%, 92%, ${opacity[9]})`,
100: `hsla(233, 11%, 84%, ${opacity[9]})`,
200: `hsla(231, 11%, 76%, ${opacity[9]})`,
Expand All @@ -262,13 +262,13 @@ const colors: Color = {
1100: `hsla(231, 54%, 15%, ${opacity[9]})`,
1200: `hsla(231, 59%, 13%, ${opacity[9]})`,
1300: `hsla(231, 67%, 10%, ${opacity[9]})`,
a00: `hsla((233, 11%, 84%, ${opacity[0]})`,
a50: `hsla((233, 11%, 84%, ${opacity[1]})`,
a100: `hsla((233, 11%, 84%, ${opacity[2]})`,
a200: `hsla((233, 11%, 84%, ${opacity[3]})`,
a00: `hsla(233, 11%, 84%, ${opacity[0]})`,
a50: `hsla(233, 11%, 84%, ${opacity[1]})`,
a100: `hsla(233, 11%, 84%, ${opacity[2]})`,
a200: `hsla(233, 11%, 84%, ${opacity[3]})`,
},
ashGrayLight: {
0: `hsla(0, 0, 100%, ${opacity[9]})`,
0: `hsla(0, 0%, 100%, ${opacity[9]})`,
50: `hsla(216, 9%, 98%, ${opacity[9]})`,
100: `hsla(216, 9%, 96%, ${opacity[9]})`,
200: `hsla(216, 6%, 94%, ${opacity[9]})`,
Expand All @@ -289,7 +289,7 @@ const colors: Color = {
a200: `hsla(214, 15%, 18%, ${opacity[3]})`,
},
ashGrayDark: {
0: `hsla(0, 0, 99%, ${opacity[9]})`,
0: `hsla(0, 0%, 99%, ${opacity[9]})`,
50: `hsla(240, 2%, 92%, ${opacity[9]})`,
100: `hsla(240, 1%, 84%, ${opacity[9]})`,
200: `hsla(228, 4%, 76%, ${opacity[9]})`,
Expand Down
40 changes: 20 additions & 20 deletions packages/blade/src/tokens/theme/bankingTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2380,43 +2380,43 @@ const shadows: Shadows = {
},
offsetY: {
level: {
1: 2,
2: 2,
3: 2,
4: 2,
5: 2,
1: 1,
2: 3,
3: 8,
4: 10,
5: 18,
},
},
blurRadius: {
level: {
1: 0,
2: 0,
3: 0,
4: 0,
5: 0,
1: 2,
2: 8,
3: 12,
4: 18,
5: 28,
},
},
color: {
level: {
1: {
onLight: colors.brand.gray[700].onLight,
onDark: colors.brand.gray[700].onDark,
onLight: globalColors.neutral.navyGrayLight.a100,
onDark: globalColors.neutral.navyGrayDark.a100,
},
2: {
onLight: colors.brand.gray[700].onLight,
onDark: colors.brand.gray[700].onDark,
onLight: globalColors.neutral.navyGrayLight.a100,
onDark: globalColors.neutral.navyGrayDark.a100,
},
3: {
onLight: colors.brand.gray[700].onLight,
onDark: colors.brand.gray[700].onDark,
onLight: globalColors.neutral.navyGrayLight.a100,
onDark: globalColors.neutral.navyGrayDark.a100,
},
4: {
onLight: colors.brand.gray[700].onLight,
onDark: colors.brand.gray[700].onDark,
onLight: globalColors.neutral.navyGrayLight.a100,
onDark: globalColors.neutral.navyGrayDark.a100,
},
5: {
onLight: colors.brand.gray[700].onLight,
onDark: colors.brand.gray[700].onDark,
onLight: globalColors.neutral.navyGrayLight.a100,
onDark: globalColors.neutral.navyGrayDark.a100,
},
},
},
Expand Down
40 changes: 20 additions & 20 deletions packages/blade/src/tokens/theme/paymentTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2380,43 +2380,43 @@ const shadows: Shadows = {
},
offsetY: {
level: {
1: 2,
2: 2,
3: 2,
4: 2,
5: 2,
1: 1,
2: 3,
3: 8,
4: 10,
5: 18,
},
},
blurRadius: {
level: {
1: 0,
2: 0,
3: 0,
4: 0,
5: 0,
1: 2,
2: 8,
3: 12,
4: 18,
5: 28,
},
},
color: {
level: {
1: {
onLight: colors.brand.gray[700].onLight,
onDark: colors.brand.gray[700].onDark,
onLight: globalColors.neutral.blueGrayLight.a100,
onDark: globalColors.neutral.blueGrayDark.a100,
},
2: {
onLight: colors.brand.gray[700].onLight,
onDark: colors.brand.gray[700].onDark,
onLight: globalColors.neutral.blueGrayLight.a100,
onDark: globalColors.neutral.blueGrayDark.a100,
},
3: {
onLight: colors.brand.gray[700].onLight,
onDark: colors.brand.gray[700].onDark,
onLight: globalColors.neutral.blueGrayLight.a100,
onDark: globalColors.neutral.blueGrayDark.a100,
},
4: {
onLight: colors.brand.gray[700].onLight,
onDark: colors.brand.gray[700].onDark,
onLight: globalColors.neutral.blueGrayLight.a100,
onDark: globalColors.neutral.blueGrayDark.a100,
},
5: {
onLight: colors.brand.gray[700].onLight,
onDark: colors.brand.gray[700].onDark,
onLight: globalColors.neutral.blueGrayLight.a100,
onDark: globalColors.neutral.blueGrayDark.a100,
},
},
},
Expand Down
14 changes: 14 additions & 0 deletions packages/examples/tokens-usage/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
rules: {
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
'react/no-unstable-nested-components': 'off',
'no-unsafe-optional-chaining': 'off',
'no-nonoctal-decimal-escape': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unnecessary-type-constraint': 'off',
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
'@typescript-eslint/sort-type-union-intersection-members': 'off',
'@typescript-eslint/triple-slash-reference': 'off',
},
};
23 changes: 23 additions & 0 deletions packages/examples/tokens-usage/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
46 changes: 46 additions & 0 deletions packages/examples/tokens-usage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `yarn start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `yarn build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
Loading

1 comment on commit d8d8027

@vercel
Copy link

@vercel vercel bot commented on d8d8027 Jul 29, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.