diff options
Diffstat (limited to 'src/containers')
-rw-r--r-- | src/containers/Page.tsx | 9 | ||||
-rw-r--r-- | src/containers/ProductForm.tsx | 14 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/containers/Page.tsx b/src/containers/Page.tsx index 0c8269e..f6ae814 100644 --- a/src/containers/Page.tsx +++ b/src/containers/Page.tsx @@ -1,10 +1,9 @@ import React from 'react'; import Paper from '../components/Paper'; -import Button from '../components/Button'; +import Button, { Props as ButtonProps } from '../components/Button'; -interface Action { +export interface Action extends ButtonProps { name: string; - route: string; } interface Props { @@ -16,7 +15,9 @@ const Page: React.FC<Props> = ({ title, actions, children }) => ( <Paper> <div className="mb-2 flex justify-between items-center"> <span className="text-2xl font-bold">{title}</span> - {actions?.map(action => (<Button size="sm" route={action.route}>{action.name}</Button>))} + <div> + {actions?.map(action => (<Button {...action} size="sm">{action.name}</Button>))} + </div> </div> {children} </Paper> diff --git a/src/containers/ProductForm.tsx b/src/containers/ProductForm.tsx new file mode 100644 index 0000000..d79b1d1 --- /dev/null +++ b/src/containers/ProductForm.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import Page, { Action } from '../containers/Page'; + +const actions: Action[] = [ + { name: 'Назад', route: '/', variant: 'outlined' }, + { name: 'Сохранить', route: '/' }, +]; + +const ProductForm: React.FC = () => ( + <Page title="Продукт" actions={actions}> + </Page> +); + +export default ProductForm; |