mirror of
https://github.com/lemeow125/Ivy-Frontend.git
synced 2024-11-16 22:29:24 +08:00
Reimplemented color values for stocks in Inventory page
This commit is contained in:
parent
3f8e91f44d
commit
1c8e7c9b5a
2 changed files with 15 additions and 1 deletions
|
@ -13,6 +13,15 @@ import {
|
|||
import { SampleInventoryData } from "../../Components/SampleData/SampleData";
|
||||
|
||||
export default function Inventory() {
|
||||
function change_color(in_stock: number) {
|
||||
if (in_stock > 0 && in_stock < 3) {
|
||||
return <TableCell style={styles.text_red}>{in_stock}</TableCell>;
|
||||
} else if (in_stock > 3 && in_stock < 9) {
|
||||
return <TableCell style={styles.text_orange}>{in_stock}</TableCell>;
|
||||
} else {
|
||||
return <TableCell style={styles.text_green}>{in_stock}</TableCell>;
|
||||
}
|
||||
}
|
||||
return (
|
||||
<div style={{ margin: 32, height: "100%" }}>
|
||||
<div style={styles.content_row}>
|
||||
|
@ -41,7 +50,7 @@ export default function Inventory() {
|
|||
>
|
||||
<TableCell style={styles.text}>{row.id}</TableCell>
|
||||
<TableCell style={styles.text}>{row.name}</TableCell>
|
||||
<TableCell style={styles.text}>{row.in_stock}</TableCell>
|
||||
{change_color(row.in_stock)}
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
|
|
|
@ -42,6 +42,11 @@ const styles: { [key: string]: React.CSSProperties } = {
|
|||
color: "#a44141",
|
||||
fontWeight: "bold",
|
||||
},
|
||||
text_orange: {
|
||||
fontSize: "1.3vw",
|
||||
color: "#c57331",
|
||||
fontWeight: "bold",
|
||||
},
|
||||
text_green: {
|
||||
fontSize: "1.3vw",
|
||||
color: "#80b28a",
|
||||
|
|
Loading…
Reference in a new issue