summaryrefslogtreecommitdiff
path: root/src/containers/Page.tsx
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2021-04-17 13:39:30 +0300
committereug-vs <eug-vs@keemail.me>2021-04-17 13:41:29 +0300
commit1bf07892f2cd8007f48469c42fa9fcc84d5ef435 (patch)
tree054d600ffa414a71f15e2dc7606121649f7587ca /src/containers/Page.tsx
parenta4a1c456e0788ca52261efb38ff3998710a42a59 (diff)
downloadcommercel-ui-1bf07892f2cd8007f48469c42fa9fcc84d5ef435.tar.gz
feat: correctly add filters from Service JSON
Diffstat (limited to 'src/containers/Page.tsx')
-rw-r--r--src/containers/Page.tsx13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/containers/Page.tsx b/src/containers/Page.tsx
index 2fe54fa..d659510 100644
--- a/src/containers/Page.tsx
+++ b/src/containers/Page.tsx
@@ -1,8 +1,13 @@
import React from 'react';
import Paper from '../components/Paper';
import Button from '../components/Button';
-import { Action, Filter } from '../lib/ServiceContext';
-import { SelectBase } from '../components/Select';
+import { Action } from '../lib/ServiceContext';
+import { Option, SelectBase } from '../components/Select';
+import { Field } from '../components/ListTable';
+
+export interface Filter extends Field {
+ options?: Option[];
+}
interface Props {
title?: string;
@@ -19,8 +24,8 @@ const Page: React.FC<Props> = ({ title, actions, filters, className, children })
<div className={`${style} ${(actions?.length || 0) > 1 ? 'flex-col items-start' : 'flex-row items-center'}`}>
<span className="text-2xl font-bold">{title}</span>
<div className="flex">
- <div className="mr-6">
- {filters?.map(filter => (<SelectBase key={filter.field} options={filter.options} />))}
+ <div className="mr-6 flex">
+ {filters?.map(filter => (<SelectBase key={filter.key} options={filter.options || []} />))}
</div>
<div>
{actions?.map(action => (<Button {...action} key={action.name} size="sm">{action.name}</Button>))}