Inventory Route

This commit is contained in:
jurenroy 2023-02-25 18:49:36 +08:00
parent 1fded3cedf
commit 03e6ac60e9
4 changed files with 67 additions and 2 deletions

View file

@ -0,0 +1,41 @@
import { Table, TableBody, TableCell, TableContainer, TableHead, TableRow } from '@mui/material';
type Product = {
id: number;
name: string;
stocks: number;
lastModified: string;
};
type ProductInfoProps = {
products: Product[];
};
export default function InventoryInfo(props: ProductInfoProps) {
const { products } = props;
return (
<TableContainer>
<Table>
<TableHead>
<TableRow>
<TableCell style={{ color: 'white' }}>Product ID</TableCell>
<TableCell style={{ color: 'white' }}>Product Name</TableCell>
<TableCell style={{ color: 'white' }}>Stocks</TableCell>
<TableCell style={{ color: 'white' }}>Last Modified</TableCell>
</TableRow>
</TableHead>
<TableBody>
{products.map((product) => (
<TableRow key={product.id}>
<TableCell style={{ color: 'white' }}>{product.id}</TableCell>
<TableCell style={{ color: 'white' }}>{product.name}</TableCell>
<TableCell style={{ color: 'white' }}>{product.stocks}</TableCell>
<TableCell style={{ color: 'white' }}>{product.lastModified}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
);
}

View file

@ -21,7 +21,6 @@ export default function ProductInfo(props: ProductInfoProps) {
<TableRow>
<TableCell style={{ color: 'white' }}>Product ID</TableCell>
<TableCell style={{ color: 'white' }}>Product Name</TableCell>
<TableCell style={{ color: 'white' }}>Stocks</TableCell>
<TableCell style={{ color: 'white' }}>Last Modified</TableCell>
</TableRow>
</TableHead>
@ -30,7 +29,6 @@ export default function ProductInfo(props: ProductInfoProps) {
<TableRow key={product.id}>
<TableCell style={{ color: 'white' }}>{product.id}</TableCell>
<TableCell style={{ color: 'white' }}>{product.name}</TableCell>
<TableCell style={{ color: 'white' }}>{product.stocks}</TableCell>
<TableCell style={{ color: 'white' }}>{product.lastModified}</TableCell>
</TableRow>
))}