un-daisy inputs

This commit is contained in:
Sinclair Chen 2022-10-12 13:58:10 -07:00
parent 58a34b474e
commit 711e2e68ed
5 changed files with 28 additions and 39 deletions

View File

@ -46,11 +46,7 @@ export function AmountInput(props: {
{label}
</span>
<Input
className={clsx(
'w-24 pl-9 !text-base md:w-auto',
error && 'input-error',
inputClassName
)}
className={clsx('w-24 pl-9 !text-base md:w-auto', inputClassName)}
ref={inputRef}
type="text"
pattern="[0-9]*"
@ -58,6 +54,7 @@ export function AmountInput(props: {
placeholder="0"
maxLength={6}
value={amount ?? ''}
error={!!error}
disabled={disabled}
onChange={(e) => onAmountChange(e.target.value)}
/>

View File

@ -92,10 +92,7 @@ export function BetInline(props: {
/>
<BuyAmountInput
className="-mb-4"
inputClassName={clsx(
'input-sm w-20 !text-base',
error && 'input-error'
)}
inputClassName="w-20 !text-base"
amount={amount}
onChange={setAmount}
error="" // handle error ourselves

View File

@ -7,7 +7,7 @@ export const ExpandingInput = (props: Parameters<typeof Textarea>[0]) => {
return (
<Textarea
className={clsx(
'textarea textarea-bordered resize-none text-[16px] md:text-[14px]',
'resize-none rounded-md border border-gray-300 bg-white px-4 text-[16px] leading-loose shadow-sm transition-colors focus:outline-none disabled:cursor-not-allowed disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 md:text-[14px]',
className
)}
{...rest}

View File

@ -2,21 +2,21 @@ import clsx from 'clsx'
import React from 'react'
/** Text input. Wraps html `<input>` */
export const Input = (props: JSX.IntrinsicElements['input']) => {
const { className, ...rest } = props
export const Input = (
props: { error?: boolean } & JSX.IntrinsicElements['input']
) => {
const { error, className, ...rest } = props
return (
<input
className={clsx('input input-bordered text-base md:text-sm', className)}
className={clsx(
'h-12 rounded-md border bg-white px-4 shadow-sm transition-colors invalid:border-red-600 invalid:text-red-900 invalid:placeholder-red-300 focus:outline-none disabled:cursor-not-allowed disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 md:text-sm',
error
? 'border-red-300 text-red-900 placeholder-red-300 focus:border-red-600 focus:ring-red-500' // matches invalid: styles
: 'border-gray-300 focus:border-indigo-500 focus:ring-indigo-500',
className
)}
{...rest}
/>
)
}
/*
TODO: replace daisyui style with our own. For reference:
james: text-lg placeholder:text-gray-400
inga: placeholder:text-greyscale-4 border-greyscale-2 rounded-md
austin: border-gray-300 text-gray-400 focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm
*/

View File

@ -32,24 +32,19 @@ export function NumberInput(props: {
return (
<Col className={className}>
<label className="input-group">
<Input
className={clsx(
'max-w-[200px] !text-lg',
error && 'input-error',
inputClassName
)}
ref={inputRef}
type="number"
pattern="[0-9]*"
inputMode="numeric"
placeholder={placeholder ?? '0'}
maxLength={9}
value={numberString}
disabled={disabled}
onChange={(e) => onChange(e.target.value.substring(0, 9))}
/>
</label>
<Input
className={clsx('max-w-[200px] !text-lg', inputClassName)}
ref={inputRef}
type="number"
pattern="[0-9]*"
inputMode="numeric"
placeholder={placeholder ?? '0'}
maxLength={9}
value={numberString}
error={!!error}
disabled={disabled}
onChange={(e) => onChange(e.target.value.substring(0, 9))}
/>
<Spacer h={4} />