Added icon to product blob view

This commit is contained in:
keannu125 2023-03-03 12:15:10 +08:00
parent 971d184697
commit 2551b1fb38
6 changed files with 36 additions and 68 deletions

View file

@ -0,0 +1,26 @@
import React from "react";
export interface props {
size: number;
color: string;
}
export default function ProductIcon(props: props) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width={props.size + "vh"}
height={props.size + "vh"}
viewBox="0 0 24 24"
stroke-width="2"
stroke={props.color}
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M7.05 11.293l4.243 -4.243a2 2 0 0 1 2.828 0l2.829 2.83a2 2 0 0 1 0 2.828l-4.243 4.243a2 2 0 0 1 -2.828 0l-2.829 -2.831a2 2 0 0 1 0 -2.828z"></path>
<path d="M16.243 9.172l3.086 -.772a1.5 1.5 0 0 0 .697 -2.516l-2.216 -2.217a1.5 1.5 0 0 0 -2.44 .47l-1.248 2.913"></path>
<path d="M9.172 16.243l-.772 3.086a1.5 1.5 0 0 1 -2.516 .697l-2.217 -2.216a1.5 1.5 0 0 1 .47 -2.44l2.913 -1.248"></path>
</svg>
);
}

View file

@ -2,6 +2,7 @@ import * as React from "react";
import styles from "../../../styles";
import { ProductList } from "../../../Interfaces/Interfaces";
import ProductIcon from "../../Icons/ProductIcon/ProductIcon";
export default function BlobView({ Products }: ProductList) {
return (
@ -19,7 +20,11 @@ export default function BlobView({ Products }: ProductList) {
padding: 16,
}}
>
<p style={styles.text}>{row.name}</p>
<div style={styles.content_row}>
<ProductIcon size={4} color="white" />{" "}
<p style={styles.text}>{row.name}</p>
</div>
<p style={styles.text}>ID: {row.id}</p>
<p style={styles.text_small}>Last Modified: {row.last_modified}</p>
</div>

View file

@ -42,7 +42,10 @@ export default function Products() {
</div>
</div>
</div>
<Switch onClick={() => toggleTableView(!tableView)} />
<div style={styles.content_row}>
<Switch onClick={() => toggleTableView(!tableView)} />
<p style={styles.text_small}>View Type</p>
</div>
{view()}
</div>
);

View file

@ -1,35 +0,0 @@
import { Table, TableBody, TableCell, TableContainer, TableHead, TableRow } from '@mui/material';
import { ProductType } from '../ProductType/ProductType';
type ProductInfoProps = {
products: ProductType[];
};
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.toString().padStart(3, '0')}</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

@ -1,7 +0,0 @@
export type ProductType = {
id: number;
name: string;
stocks: number;
lastModified: string;
};

View file

@ -1,24 +0,0 @@
const ProductsLists = [
{
id: 1,
name: 'Product 1',
stocks: 10,
lastModified: '3/2/2023, 2:11:45 PM'
},
{
id: 2,
name: 'Product 2',
stocks: 5,
lastModified: '3/2/2023, 2:21:23 PM'
},
{
id: 3,
name: 'Product 3',
stocks: 15,
lastModified: '3/2/2023, 1:35:56 PM'
},
// add more products here
];
export default ProductsLists;