refactor(infra.mareshq.com): put tables into component and add horizontal overflow
This commit is contained in:
parent
f1d73a22a2
commit
fa96a47bdf
2 changed files with 82 additions and 67 deletions
23
themes/infra/components/Table.tsx
Normal file
23
themes/infra/components/Table.tsx
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { ReactNode, FunctionComponent } from 'react';
|
||||
|
||||
type Props = {
|
||||
columnNames: string[];
|
||||
children?: ReactNode;
|
||||
};
|
||||
|
||||
const Table = ({ columnNames, children }: Props) => (
|
||||
<div className="overflow-x-auto">
|
||||
<table className="table-fixed min-w-full">
|
||||
<thead className="text-left">
|
||||
<tr>
|
||||
{columnNames.map((cn) => (
|
||||
<th className="py-1 px-2">{cn}</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
{children}
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
|
||||
export default Table;
|
||||
Reference in a new issue