adjust sidebar effect

This commit is contained in:
Qing
2024-04-13 15:44:07 +08:00
parent 76823355fe
commit ccea072dc5
4 changed files with 242 additions and 195 deletions

View File

@@ -44,7 +44,10 @@ export interface NumberInputProps extends InputProps {
}
const NumberInput = React.forwardRef<HTMLInputElement, NumberInputProps>(
({ numberValue, allowFloat, onNumberValueChange, ...rest }, ref) => {
(
{ numberValue, allowFloat, onNumberValueChange, className, ...rest },
ref
) => {
const [value, setValue] = React.useState<string>(numberValue.toString())
React.useEffect(() => {
@@ -75,7 +78,15 @@ const NumberInput = React.forwardRef<HTMLInputElement, NumberInputProps>(
setValue(val)
}
return <Input ref={ref} value={value} onInput={onInput} {...rest} />
return (
<Input
ref={ref}
value={value}
onInput={onInput}
className={cn("text-center", className)}
{...rest}
/>
)
}
)