diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/ServiceContext.tsx | 6 | ||||
-rw-r--r-- | src/lib/ServiceList.tsx | 11 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/lib/ServiceContext.tsx b/src/lib/ServiceContext.tsx index f7170d1..ec76106 100644 --- a/src/lib/ServiceContext.tsx +++ b/src/lib/ServiceContext.tsx @@ -2,11 +2,17 @@ import React from 'react'; import { FormikProps } from 'formik'; import { Props as ButtonProps } from '../components/Button'; import { Field } from '../components/ListTable'; +import { Option } from '../components/Select'; export interface Action extends ButtonProps { name: string; } +export interface Filter { + field: string; + options: Option[]; +} + export interface PanelProps<T> { item: T; mutate: (item: T) => void; diff --git a/src/lib/ServiceList.tsx b/src/lib/ServiceList.tsx index e7015ae..a3c9842 100644 --- a/src/lib/ServiceList.tsx +++ b/src/lib/ServiceList.tsx @@ -16,6 +16,15 @@ const ServiceList: React.FC = () => { route: `/${service.route}/add${location.search}`, }]; + const filters = [{ + field: '_id', + options: [ + { key: 'a', label: 'a' }, + { key: 'b', label: 'b' }, + { key: 'c', label: 'c' }, + ], + }]; + const handleRowClick = (item: any) => { const route = service.rowLink ? service.rowLink(item) @@ -25,7 +34,7 @@ const ServiceList: React.FC = () => { }; return ( - <Page title={service.name} actions={actions}> + <Page title={service.name} actions={actions} filters={filters}> <ListTable items={data} fields={service.tableFields} handleRowClick={handleRowClick} /> </Page> ); |