Working tree is now the canonical repo. Off-chain play-money + trustless on-chain (FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution, mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
87 lines
2.4 KiB
TypeScript
87 lines
2.4 KiB
TypeScript
import clsx from 'clsx'
|
|
import { Col } from '../layout/col'
|
|
import { formatSweepiesNumber, InputTokenType } from 'common/util/format'
|
|
|
|
export const IncrementButton = (props: {
|
|
amount: number
|
|
onIncrement: () => void
|
|
className?: string
|
|
token?: InputTokenType
|
|
}) => {
|
|
const { amount, onIncrement, className, token = 'M$' } = props
|
|
|
|
const displayedAmount =
|
|
token === 'CASH' ? formatSweepiesNumber(amount, { short: true }) : amount
|
|
|
|
return (
|
|
<button
|
|
className={clsx(
|
|
className,
|
|
'text-ink-500 active:bg-ink-100 active:text-ink-600 hover:text-ink-600 flex w-12 flex-row items-center justify-center'
|
|
)}
|
|
onClick={onIncrement}
|
|
>
|
|
<div className="pointer-events-none text-xs">+{displayedAmount}</div>
|
|
</button>
|
|
)
|
|
}
|
|
|
|
export const IncrementDecrementButton = (props: {
|
|
onIncrement: () => void
|
|
onDecrement: () => void
|
|
className?: string
|
|
}) => {
|
|
const { onIncrement, onDecrement, className } = props
|
|
|
|
return (
|
|
<Col className={className}>
|
|
<button
|
|
className={clsx(
|
|
'text-ink-500 active:bg-ink-100 active:text-ink-600 hover:text-ink-600 flex h-[24px] w-12 flex-row items-center justify-center'
|
|
)}
|
|
onClick={onIncrement}
|
|
>
|
|
<div className="pointer-events-none">+</div>
|
|
</button>
|
|
<button
|
|
className={clsx(
|
|
'text-ink-500 active:bg-ink-100 active:text-ink-600 hover:text-ink-600 flex h-[22px] w-12 flex-row items-center justify-center'
|
|
)}
|
|
onClick={onDecrement}
|
|
>
|
|
<div className="pointer-events-none">-</div>
|
|
</button>
|
|
</Col>
|
|
)
|
|
}
|
|
|
|
const buttonClasses =
|
|
'text-ink-400 flex h-[35px] w-12 flex-row items-center justify-center active:bg-ink-100'
|
|
export const IncrementDecrementAmountButton = (props: {
|
|
amount: number
|
|
incrementBy: (amount: number) => void
|
|
token: InputTokenType
|
|
}) => {
|
|
const { amount, incrementBy, token = 'M$' } = props
|
|
|
|
const displayedAmount =
|
|
token === 'CASH' ? formatSweepiesNumber(amount, { short: true }) : amount
|
|
|
|
return (
|
|
<Col className="divide-ink-300 mt-[1px] divide-y text-xs">
|
|
<button
|
|
className={clsx(buttonClasses, '')}
|
|
onClick={() => incrementBy(amount)}
|
|
>
|
|
+{displayedAmount}
|
|
</button>
|
|
<button
|
|
className={clsx(buttonClasses, '')}
|
|
onClick={() => incrementBy(-amount)}
|
|
>
|
|
-{displayedAmount}
|
|
</button>
|
|
</Col>
|
|
)
|
|
}
|