diff options
Diffstat (limited to 'src/containers/Page.tsx')
-rw-r--r-- | src/containers/Page.tsx | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/containers/Page.tsx b/src/containers/Page.tsx index ae9e231..2fe54fa 100644 --- a/src/containers/Page.tsx +++ b/src/containers/Page.tsx @@ -1,28 +1,37 @@ import React from 'react'; import Paper from '../components/Paper'; import Button from '../components/Button'; -import { Action } from '../lib/ServiceContext'; +import { Action, Filter } from '../lib/ServiceContext'; +import { SelectBase } from '../components/Select'; interface Props { title?: string; actions?: Action[]; + filters?: Filter[]; className?: string; } const style = 'mb-2 flex justify-between md:flex-row md:items-center'; -const Page: React.FC<Props> = ({ title, actions, className, children }) => ( - <Paper className="xl:m-5"> - <div className={`${style} ${(actions?.length || 0) > 1 ? 'flex-col items-start' : 'flex-row items-center'}`}> - <span className="text-2xl font-bold">{title}</span> - <div> - {actions?.map(action => (<Button {...action} key={action.name} size="sm">{action.name}</Button>))} +const Page: React.FC<Props> = ({ title, actions, filters, className, children }) => { + return ( + <Paper className="xl:m-5"> + <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> + <div> + {actions?.map(action => (<Button {...action} key={action.name} size="sm">{action.name}</Button>))} + </div> + </div> </div> - </div> - <div className={className}> - {children} - </div> - </Paper> -); + <div className={className}> + {children} + </div> + </Paper> + ); +}; export default Page; |