Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal View Spreadsheet #35

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions app/components/InventorySpreadsheet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import React from "react";
import Image from 'next/image';
import deleteIcon from '../images/delete.png';
import downloadIcon from "../images/download.png";
import editIcon from "../images/edit.png";
import arrowsIcon from "../images/upAndDownArrows.png";

interface InventorySpreadsheetProps {
inventoryItems: (string | number)[][];
}

export const InventorySpreadsheet: React.FC<InventorySpreadsheetProps> = ({ inventoryItems = [] }) => {
console.log("inventoryItems:", inventoryItems);

return(
<div className="relative overflow-x-auto crimson-regular font-crimson">
<table className="table-auto w-full">
<thead className ="font-crimson border- crimson-regular border-separate content-start">
<tr className="bg-dark-blue text-white text-lg align-left ">
<th className="border-collapse border-zinc-50 border-2 border-y-1 py-2 px-3">
<div className="flex flex-row justify-between">
<p>Last Updated</p>
<Image src={arrowsIcon}
width={15}
height={15}
alt="arrows Icon"
className="">
</Image>
</div>
</th>
<th className="border-collapse border-zinc-50 border-2 border-y-1 py-2 px-3">
<div className="flex flex-row justify-between">
<p>Category</p>
<Image src={arrowsIcon}
width={15}
height={15}
alt="arrows Icon"
className="">
</Image>
</div>
</th>
<th className="border-collapse border-zinc-50 border-2 border-y-1 py-2 px-3">
<div className="flex flex-row justify-between">
<p>Item Name</p>
<Image src={arrowsIcon}
width={15}
height={15}
alt="arrows Icon"
className="">
</Image>
</div>
</th>
<th className="border-collapse border-zinc-50 border-2 border-y-1 py-2 px-3">
<div className="flex flex-row justify-between">
<p>Quantity</p>
<Image src={arrowsIcon}
width={15}
height={15}
alt="arrows Icon"
className="">
</Image>
</div>
</th>
<th className="border-collapse border-zinc-50 border-2 border-y-1 py-2 px-3">Units</th>
<th className="border-collapse border-zinc-50 border-2 border-y-1 py-2 px-3">Actions</th>
</tr>
</thead>
<tbody className="bg-zinc-75 border-collapse border-zinc-400 font-crimson crimson-regular">
{inventoryItems.map((item, index) => (
<tr key={index} className="py-2">
{item.map((data, subIndex) => (
<td
key={subIndex}
className="border-collapse border-zinc-200 border-2 border-y-1 py-2 px-3"
>
{data}
</td>
))}
<td
key={`actions-${index}`}
className="flex row justify-around border-collapse border-zinc-300 border-2 border-y-1 py-2 px-3"
>
<Image
src={editIcon}
width={18}
height={18}
alt="edit Icon"
className=""
/>
<Image
src={deleteIcon}
width={18}
height={18}
alt="delete Icon"
className=""
/>
<Image
src={downloadIcon}
width={18}
height={18}
alt="download Icon"
className=""
/>
</td>
</tr>
))}
</tbody>
</table>
</div>

)

}
Binary file added app/images/delete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/upAndDownArrows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions app/inventory/[[...inventory]]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from "react";
import { InventorySpreadsheet } from '@app/components/InventorySpreadsheet';

const inventoryItems = [
['date1', 'Fruits', 'Apple', 4, 'units'],
['date2', 'Fruits', 'Apple', 5, 'lbs'],
['date3', 'Vegetables', 'Carrot', 10, 'units'],
['date4', 'Grains', 'Rice', 2, 'kg']
];

const InternalViewInventoryPage: React.FC = () => {

return (
<InventorySpreadsheet inventoryItems={inventoryItems} />
);
};

export default InternalViewInventoryPage;

1 change: 1 addition & 0 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const config: Config = {
'light-gray': "#E1E1E1",
'modal-gray': "#EEEEEE",
'gray': "#828282",
'dark-blue': "#3851BC"
},
fontFamily: {
serif: ["'Crimson Text'", "serif"],
Expand Down
Loading