refactoring
This commit is contained in:
parent
717b41384c
commit
395234f919
@ -28,9 +28,9 @@ function ProjectManager(){
|
||||
|
||||
async function getViewMap(): Promise<Map<string, JSX.Element>> {
|
||||
return new Map([
|
||||
['home', <Home></Home>],
|
||||
['man-post', <PostView></PostView>],
|
||||
['man-proj', <ProjectView></ProjectView>]
|
||||
['home', <Home key={0}></Home>],
|
||||
['man-post', <PostView key={1}></PostView>],
|
||||
['man-proj', <ProjectView key={2}></ProjectView>]
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@ -1,18 +1,26 @@
|
||||
'use client'
|
||||
import { ReactNode } from "react";
|
||||
|
||||
type TableGenOptions = {
|
||||
editButton:boolean;
|
||||
deleteButton:boolean;
|
||||
}
|
||||
|
||||
type Props = {
|
||||
headings:Array<string>;
|
||||
children:ReactNode;
|
||||
options?:TableGenOptions
|
||||
}
|
||||
|
||||
export default function TableGen(props:Props){
|
||||
const options = props.options ? props.options : {editButton: true, deleteButton: true}
|
||||
console.log(props.headings)
|
||||
return <>
|
||||
<table className="table overflow-scroll">
|
||||
<thead>
|
||||
<tr>
|
||||
{[...props.headings,'Edit', 'Delete'].map((h)=>
|
||||
<th key={h} scope="col">{h}</th>
|
||||
{[...props.headings,options.editButton ? 'Edit' : null, options.deleteButton ? 'Delete' : null].map((h)=>
|
||||
h ? <th key={h} scope="col">{h}</th> : ''
|
||||
)}
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user