User experience improvements
Summary: This diff has some jak-shaving UX improvements after playing with the DataTable a bit more: Selection * deselecting a row from a larger set will make the last selected item the default selection * re-selecting an item in a single selection will unselect it Column Filtering * Introduced button to toggle between filtering on all, nothing, and the values present in the current selection Column sorting * The up / down arrows are now inidividually clickable, rather than action as a general toggle * Title still works as a general toggle between asc / desc / not sorted Context menu * I found the context menu for column selection and on the selected rows itself a bit finicky to find and click and not super intuitive for noob users. Merged both menus instead into a single hamburger menu adjacent to the search bar Reviewed By: passy Differential Revision: D26580038 fbshipit-source-id: 220f501a1d996acbd51088c08ea866caed768572
This commit is contained in:
committed by
Facebook GitHub Bot
parent
59a1327261
commit
59e6c98669
@@ -7,7 +7,8 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {Input} from 'antd';
|
||||
import {MenuOutlined} from '@ant-design/icons';
|
||||
import {Button, Dropdown, Input} from 'antd';
|
||||
import React, {memo} from 'react';
|
||||
import {Layout} from '../Layout';
|
||||
import {theme} from '../theme';
|
||||
@@ -15,9 +16,12 @@ import {theme} from '../theme';
|
||||
export const TableSearch = memo(function TableSearch({
|
||||
onSearch,
|
||||
extraActions,
|
||||
contextMenu,
|
||||
}: {
|
||||
onSearch(value: string): void;
|
||||
extraActions?: React.ReactElement;
|
||||
hasSelection?: boolean;
|
||||
contextMenu?: React.ReactElement;
|
||||
}) {
|
||||
return (
|
||||
<Layout.Horizontal
|
||||
@@ -28,6 +32,13 @@ export const TableSearch = memo(function TableSearch({
|
||||
}}>
|
||||
<Input.Search allowClear placeholder="Search..." onSearch={onSearch} />
|
||||
{extraActions}
|
||||
{contextMenu && (
|
||||
<Dropdown overlay={contextMenu} placement="bottomRight">
|
||||
<Button type="text" size="small" style={{height: '100%'}}>
|
||||
<MenuOutlined />
|
||||
</Button>
|
||||
</Dropdown>
|
||||
)}
|
||||
</Layout.Horizontal>
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user