summaryrefslogtreecommitdiff
path: root/src/containers/Page.tsx
blob: 0c8269e8f3df2c72554444ebcb608ed4abea6e8a (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
import React from 'react';
import Paper from '../components/Paper';
import Button from '../components/Button';

interface Action {
  name: string;
  route: string;
}

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

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>
    {children}
  </Paper>
);

export default Page;