feat: 지붕재 적합성 검색어 30글자 제한 처리 추가
This commit is contained in:
parent
55c15c44ac
commit
7f0d1cf877
@ -12,6 +12,15 @@ export default function SuitableSearch() {
|
||||
const { getSuitableCommCode, clearSuitableSearch } = useSuitable()
|
||||
const { suitableCommCode, selectedCategory, setSelectedCategory, setSearchKeyword } = useSuitableStore()
|
||||
|
||||
const handleInputChange = (value: string) => {
|
||||
if (Array.from(value).length > 30) {
|
||||
alert('検索ワードは最大30文字まで入力できます。')
|
||||
setSearchValue(value.slice(0, 30))
|
||||
return
|
||||
}
|
||||
setSearchValue(value)
|
||||
}
|
||||
|
||||
const handleInputSearch = async () => {
|
||||
if (!searchValue.trim()) {
|
||||
alert('屋根材の製品名を入力してください。')
|
||||
@ -51,7 +60,7 @@ export default function SuitableSearch() {
|
||||
className="search-frame"
|
||||
placeholder="屋根材 製品名を入力してください."
|
||||
value={searchValue}
|
||||
onChange={(e) => setSearchValue(e.target.value)}
|
||||
onChange={(e) => handleInputChange(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
handleInputSearch()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user