mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-12 19:03:47 +00:00
5a397c6da7
* wip: migrate sheet settings --------- Co-authored-by: arc-alex <ac@omnivox.dk>
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
import { Input } from '@chakra-ui/react';
|
|
import { ExcelImportMap } from 'ontime-utils';
|
|
|
|
import style from './ImportMapTable.module.scss';
|
|
|
|
export type TableEntry = { label: string; title: keyof ExcelImportMap; value: string };
|
|
|
|
interface ImportMapTableProps {
|
|
title: string;
|
|
fields: TableEntry[];
|
|
handleOnChange: (field: keyof ExcelImportMap, value: string) => void;
|
|
}
|
|
|
|
export default function ImportMapTable(props: ImportMapTableProps) {
|
|
const { title, fields, handleOnChange } = props;
|
|
|
|
return (
|
|
<table className={style.importTable}>
|
|
<thead>
|
|
<tr>
|
|
<td colSpan={2}>{title}</td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{fields.map((field) => {
|
|
return (
|
|
<tr key={field.title}>
|
|
<td className={style.label}>
|
|
<label htmlFor={field.title}>{field.label}</label>
|
|
</td>
|
|
<td className={style.input}>
|
|
<Input
|
|
id={field.title}
|
|
size='sm'
|
|
variant='ontime-filled'
|
|
maxLength={25}
|
|
defaultValue={field.value}
|
|
placeholder='Use default column name'
|
|
onBlur={(event) => {
|
|
handleOnChange(field.title, event.target.value);
|
|
}}
|
|
/>
|
|
</td>
|
|
</tr>
|
|
);
|
|
})}
|
|
</tbody>
|
|
</table>
|
|
);
|
|
}
|