芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/www/wp-content/plugins/envato-elements/src/js/react/components/Search/TextInput.jsx
import React, { useEffect, useState } from 'react' import styles from './TextInput.module.scss' /** * * * @param defaultText * @param placeholderText * @param onSearchSubmitted * @returns {*} * @constructor */ const TextInput = ({ searchParams, placeholderText = 'Search...', onSearchSubmitted }) => { const [searchText, setSearchText] = useState(searchParams.text || '') useEffect(() => { setSearchText(searchParams.text || '') }, [searchParams]) return (
{ e.preventDefault() onSearchSubmitted({ text: searchText }) return false }} >
{ setSearchText(e.target.value) }} className={styles.searchTextInput} style={{ width: '100%' }} />
) } export default TextInput