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