Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

Commit

Permalink
react-resval v1.0.0-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
nurulakbaral committed Jan 10, 2023
1 parent f8598e6 commit d5957d6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
- run: npx nx affected --target=lint --fix --parallel --base=main --head=HEAD
- run: npx nx format:write --uncommitted
- run: npx nx test react-resval
- run: npx nx e2e docs-react-e2e --prod
# - run: npx nx e2e docs-react-e2e --prod
3 changes: 2 additions & 1 deletion docs/docs-react/src/app/resval.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useVx } from '../hooks/use-vx'

export default function Resval() {
const [count, setCount] = React.useState(0)
const { color1 } = useVx()
const { color1, value } = useVx()

return (
<div>
Expand All @@ -17,6 +17,7 @@ export default function Resval() {
>
Count: {count}
</h1>
<h1>{value}</h1>
</div>
)
}
16 changes: 14 additions & 2 deletions docs/docs-react/src/hooks/use-vx.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable prefer-const */

import { createResponsiveValues } from '@resval/react-responsive-values'
// dev
// import { createResponsiveValues } from '@resval/react-responsive-values'
// prod
import { createResponsiveValues } from '../../../../dist/packages/react-resval'

const vx = createResponsiveValues({
breakpoints: {
Expand All @@ -17,7 +20,7 @@ const vx = createResponsiveValues({

let utilityValues: any = {}

for (let i = 0; i < 1000_000; i++) {
for (let i = 0; i < 100_000; i++) {
utilityValues[`color${i}`] = {
base: 'red',
xs: 'green',
Expand All @@ -28,6 +31,15 @@ for (let i = 0; i < 1000_000; i++) {
}
}

utilityValues['value'] = {
base: 'base',
xs: 'xs',
sm: 'sm',
md: 'md',
lg: 'lg',
xl: 'xl',
}

export function useVx() {
return vx(utilityValues)
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"nx affected --target=lint --fix --parallel --base=feat/add-cache-for-optimizing-rendering --head=HEAD",
"nx affected --target=lint --fix --parallel --base=main --head=HEAD",
"nx format:write --uncommitted"
]
}
Expand Down

0 comments on commit d5957d6

Please sign in to comment.