Skip to content

Commit

Permalink
docs: modify docs
Browse files Browse the repository at this point in the history
  • Loading branch information
vikiboss committed Aug 14, 2024
1 parent 2ed32ff commit 8cd116d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
8 changes: 4 additions & 4 deletions docs/src/components/zone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ const colors = {
}

const borderTypes = {
solid: 'border-solid',
dashed: 'border-dashed',
dotted: 'border-dotted',
double: 'border-double',
solid: 'border border-solid',
dashed: 'border border-dashed',
dotted: 'border border-dotted',
double: 'border border-double',
}

interface Props {
Expand Down
1 change: 0 additions & 1 deletion src/use-clamp/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export function App() {
<div className="rounded transition-all p-1 bg-primary/36 box-content" style={{ width: max * 20 }}>
<div className="rounded transition-all h-[20px] bg-primary/80" style={{ width: count * 20 }} />
</div>

<Zone>
<KeyValue label="Min" value={min} />
<KeyValue label="Max" value={max} />
Expand Down
8 changes: 4 additions & 4 deletions src/use-clamp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ export type UseClampReturns = readonly [number, UseCounterReturnsAction]
*
* Essentially, it's a more semantic version of [useCounter](/reference/use-counter) with `min` and `max` options set.
*/
export function useClamp(value: Gettable<number>, min: Gettable<number>, max: Gettable<number>): UseClampReturns {
const inputNumber = unwrapGettable(value)
export function useClamp(input: Gettable<number>, min: Gettable<number>, max: Gettable<number>): UseClampReturns {
const inputValue = unwrapGettable(input)

const [result, actions] = useCounter(inputNumber, {
const [result, actions] = useCounter(inputValue, {
max: unwrapGettable(max),
min: unwrapGettable(min),
})

useUpdateEffect(() => void actions.set(inputNumber), [inputNumber])
useUpdateEffect(() => void actions.set(inputValue), [inputValue])

return [result, actions] as const
}

0 comments on commit 8cd116d

Please sign in to comment.