META-INF.resources.js.components.management-toolbar.ManagementToolbarSearch.js Maven / Gradle / Ivy
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
import {ClayButtonWithIcon} from '@clayui/button';
import {ClayInput} from '@clayui/form';
import {ManagementToolbar} from 'frontend-js-components-web';
import React, {useEffect, useState} from 'react';
export default function ManagementToolbarSearch({
disabled,
onSubmit,
searchText = '',
setShowMobile,
showMobile,
...restProps
}) {
const [value, setValue] = useState(searchText);
useEffect(() => {
setValue(searchText);
}, [searchText]);
return (
{
event.preventDefault();
onSubmit(value.trim());
}}
showMobile={showMobile}
>
setValue(value)}
placeholder={`${Liferay.Language.get('search')}...`}
type="text"
value={value}
{...restProps}
/>
setShowMobile(false)}
symbol="times"
/>
);
}