summaryrefslogtreecommitdiff
path: root/src/containers/Page.tsx
blob: 6282748840bf36f00b75e898de34b064c5c03b78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import React from 'react';
import Paper from '../components/Paper';
import Button, { Props as ButtonProps } from '../components/Button';

export interface Action extends ButtonProps {
  name: string;
}

interface Props {
  title?: string;
  actions?: Action[];
  className?: string;
}

const Page: React.FC<Props> = ({ title, actions, className, children }) => (
  <Paper className="xl:m-5">
    <div className="mb-2 flex justify-between items-center">
      <span className="text-2xl font-bold">{title}</span>
      <div>
        {actions?.map(action => (<Button {...action} key={action.name} size="sm">{action.name}</Button>))}
      </div>
    </div>
    <div className={className}>
      {children}
    </div>
  </Paper>
);

export default Page;