Unverified Commit 50b11e92 authored by Matri's avatar Matri Committed by GitHub

fix: change config string variable limit (#837)

Co-authored-by: 's avatarcrazywoola <100913391+crazywoola@users.noreply.github.com>
parent 7cc81b42
'use client' 'use client'
import React, { FC, } from 'react' import type { FC } from 'react'
import React from 'react'
export interface IConfigStringProps { export type IConfigStringProps = {
value: number | undefined value: number | undefined
onChange: (value: number | undefined) => void onChange: (value: number | undefined) => void
} }
const MAX_LENGTH = 64 const MAX_LENGTH = 256
const ConfigString: FC<IConfigStringProps> = ({ const ConfigString: FC<IConfigStringProps> = ({
value, value,
onChange, onChange,
}) => { }) => {
return ( return (
<div> <div>
<input <input
...@@ -20,13 +20,8 @@ const ConfigString: FC<IConfigStringProps> = ({ ...@@ -20,13 +20,8 @@ const ConfigString: FC<IConfigStringProps> = ({
max={MAX_LENGTH} max={MAX_LENGTH}
min={1} min={1}
value={value || ''} value={value || ''}
onChange={e => { onChange={(e) => {
let value = parseInt(e.target.value, 10) const value = Math.max(1, Math.min(MAX_LENGTH, parseInt(e.target.value))) || 1
if (value > MAX_LENGTH) {
value = MAX_LENGTH
} else if (value < 1) {
value = 1
}
onChange(value) onChange(value)
}} }}
className="w-full px-3 text-sm leading-9 text-gray-900 border-0 rounded-lg grow h-9 bg-gray-50 focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200" className="w-full px-3 text-sm leading-9 text-gray-900 border-0 rounded-lg grow h-9 bg-gray-50 focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment