| 1 |
import { Table, TableHeader, TableBody, TableProps } from '@patternfly/react-table/deprecated'; |
| 2 |
import { |
| 3 |
Bullseye, |
| 4 |
EmptyState, |
| 5 |
EmptyStateVariant, |
| 6 |
EmptyStateBody, |
| 7 |
Button, |
| 8 |
EmptyStateFooter, |
| 9 |
EmptyStateActions |
| 10 |
} from '@patternfly/react-core'; |
| 11 |
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon'; |
| 12 |
|
| 13 |
// This example has been simplified to focus on the empty state. In real usage, |
| 14 |
// you may want to derive your rows from typed underlying data and minimal state. See other examples. |
| 15 |
|
| 16 |
export const LegacyTableEmptyState: React.FunctionComponent = () => { |
| 17 |
const columns: TableProps['cells'] = ['Repositories', 'Branches', 'Pull requests', 'Workspaces', 'Last commit']; |
| 18 |
const rows: TableProps['rows'] = [ |
| 19 |
{ |
| 20 |
heightAuto: true, |
| 21 |
cells: [ |
| 22 |
{ |
| 23 |
props: { colSpan: 8 }, |
| 24 |
title: ( |
| 25 |
<Bullseye> |
| 26 |
<EmptyState |
| 27 |
headingLevel="h2" |
| 28 |
titleText="No results found" |
| 29 |
icon={SearchIcon} |
| 30 |
variant={EmptyStateVariant.sm} |
| 31 |
> |
| 32 |
<EmptyStateBody>Clear all filters and try again.</EmptyStateBody> |
| 33 |
<EmptyStateFooter> |
| 34 |
<EmptyStateActions> |
| 35 |
<Button variant="link">Clear all filters</Button> |
| 36 |
</EmptyStateActions> |
| 37 |
</EmptyStateFooter> |
| 38 |
</EmptyState> |
| 39 |
</Bullseye> |
| 40 |
) |
| 41 |
} |
| 42 |
] |
| 43 |
} |
| 44 |
]; |
| 45 |
|
| 46 |
return ( |
| 47 |
<Table aria-label="Table text with modifiers" cells={columns} rows={rows}> |
| 48 |
<TableHeader /> |
| 49 |
<TableBody /> |
| 50 |
</Table> |
| 51 |
); |
| 52 |
}; |