diff --git a/src/pages/notification/blocks/ListToolbar.tsx b/src/pages/notification/blocks/ListToolbar.tsx index 2f4c918..823454b 100644 --- a/src/pages/notification/blocks/ListToolbar.tsx +++ b/src/pages/notification/blocks/ListToolbar.tsx @@ -1,22 +1,10 @@ import { DefaultTooltip, KeenIcon, useDataGrid } from '@/components'; import { useManageNotificationContext } from '../hooks/useManageNotificationContext'; import { Button } from '@/components/ui/button'; -import React, { useState } from 'react'; const ListToolBar = () => { const { table, reload } = useDataGrid(); const { handleAddDialog } = useManageNotificationContext(); - const [searchValue, setSearchValue] = useState(''); - - const handleKeydown = (event: React.KeyboardEvent) => { - if (event.key === 'Enter') { - handleSearch(); - } - }; - - const handleSearch = () => { - table.getColumn('content')?.setFilterValue(searchValue); - }; return (
@@ -27,13 +15,12 @@ const ListToolBar = () => { setSearchValue(event.target.value)} - onKeyDown={handleKeydown} + placeholder="Search notifications" + value={table.getColumn(`content`)?.getFilterValue() as string} + onChange={(event) => table.getColumn('content')?.setFilterValue(event.target.value)} /> - + {/* - + */}
- + */}
diff --git a/src/pages/settings/user/manage-user/blocks/ListToolBar.tsx b/src/pages/settings/user/manage-user/blocks/ListToolBar.tsx index daa8cec..a884d14 100644 --- a/src/pages/settings/user/manage-user/blocks/ListToolBar.tsx +++ b/src/pages/settings/user/manage-user/blocks/ListToolBar.tsx @@ -1,22 +1,10 @@ import { DefaultTooltip, KeenIcon, useDataGrid } from '@/components'; import { useUserContext } from '../hooks'; import { Button } from '@/components/ui/button'; -import React, { useState } from 'react'; const ListToolBar = () => { const { table, reload } = useDataGrid(); const { handleAddDialog } = useUserContext(); - const [searchValue, setSearchValue] = useState(''); - - const handleSearch = () => { - table.getColumn('username')?.setFilterValue(searchValue); - }; - - const handleKeyDown = (event: React.KeyboardEvent) => { - if (event.key === 'Enter') { - handleSearch(); - } - }; return (
@@ -28,12 +16,13 @@ const ListToolBar = () => { setSearchValue(event.target.value)} - onKeyDown={handleKeyDown} + value={table.getColumn(`username`)?.getFilterValue() as string} + onChange={(event) => + table.getColumn('username')?.setFilterValue(event.target.value) + } /> - + {/* - + */}