diff --git a/src/components/Table.tsx b/src/components/Table.tsx new file mode 100644 index 0000000000000000000000000000000000000000..495217585b719c570839d207da2391b8629f874f --- /dev/null +++ b/src/components/Table.tsx @@ -0,0 +1,40 @@ +import { Part } from "../data/parts"; + +export function PartTable(data: Array<Part>, cols: Array<string>){ + let list = []; + for (let index = 0; index < data.length; index++) { + list.push( + <tr> + <td>{data[index].partname}</td> + <td><a href={data[index].url}>{data[index].registrycode}</a></td> + <td>{data[index].description}</td> + <td>{data[index].length}</td> + <td>{data[index].type}</td> + </tr> + ) + } + let heads = []; + for (let index = 0; index < cols.length; index++) { + heads.push(<td>cols[index]</td>) + } + return( + <div className="flex flex-col"> + <div className="overflow-x-auto sm:-mx-6 lg:-mx-8"> + <div className="inline-block min-w-full py-4 sm:px-6 lg:px-8"> + <div className="overflow-hidden p-2"> + <table className="min-w-full text-center"> + <thead className="border-b bg-gray-50"> + <tr> + {heads} + </tr> + </thead> + <tbody> + {list} + </tbody> + </table> + </div> + </div> + </div> + </div> + ) +} \ No newline at end of file diff --git a/src/data/parts.ts b/src/data/parts.ts new file mode 100644 index 0000000000000000000000000000000000000000..464d9f13e0142f7f0baa0c93d67a5801377664a1 --- /dev/null +++ b/src/data/parts.ts @@ -0,0 +1,45 @@ +export interface Part{ + partname: string, + registrycode: number, + description: string, + length: number, + type: PartType, + url: string +} +type PartType = "DNA" | "Protein"; + +/* +Vorlage: + +{ + partname: "", + registrycode: , + description: "", + length: , + type: "", + url: "" + }, + +*/ + +export const BasicParts: Array<Part> = [ + { + partname: "Beispiel", + registrycode: 0, + description: "Beispiel Description", + length: 0, + type: "DNA", + url: "....." + }, +] + +export const CompositeParts: Array<Part> = [ + { + partname: "Beispiel", + registrycode: 0, + description: "Beispiel Description", + length: 0, + type: "DNA", + url: "....." + }, +] \ No newline at end of file