Last active
February 7, 2025 09:27
-
-
Save amritmaurya1504/2f1ac05b282270564e6aa44f44b0d08f to your computer and use it in GitHub Desktop.
This is Metrics Component Code Snippet of Reastaurant POS System
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // METRICS | |
| import React from "react"; | |
| import { itemsData, metricsData } from "../../constants"; | |
| const Metrics = () => { | |
| return ( | |
| <div className="container mx-auto py-2 px-6 md:px-4"> | |
| <div className="flex justify-between items-center"> | |
| <div> | |
| <h2 className="font-semibold text-[#f5f5f5] text-xl"> | |
| Overall Performance | |
| </h2> | |
| <p className="text-sm text-[#ababab]"> | |
| Lorem, ipsum dolor sit amet consectetur adipisicing elit. | |
| Distinctio, obcaecati? | |
| </p> | |
| </div> | |
| <button className="flex items-center gap-1 px-4 py-2 rounded-md text-[#f5f5f5] bg-[#1a1a1a]"> | |
| Last 1 Month | |
| <svg | |
| className="w-3 h-3" | |
| viewBox="0 0 24 24" | |
| stroke="currentColor" | |
| strokeWidth="4" | |
| > | |
| <path d="M19 9l-7 7-7-7" /> | |
| </svg> | |
| </button> | |
| </div> | |
| <div className="mt-6 grid grid-cols-4 gap-4"> | |
| {metricsData.map((metric, index) => { | |
| return ( | |
| <div | |
| key={index} | |
| className="shadow-sm rounded-lg p-4" | |
| style={{ backgroundColor: metric.color }} | |
| > | |
| <div className="flex justify-between items-center"> | |
| <p className="font-medium text-xs text-[#f5f5f5]"> | |
| {metric.title} | |
| </p> | |
| <div className="flex items-center gap-1"> | |
| <svg | |
| className="w-3 h-3" | |
| viewBox="0 0 24 24" | |
| stroke="currentColor" | |
| strokeWidth="4" | |
| fill="none" | |
| style={{ color: metric.isIncrease ? "#f5f5f5" : "red" }} | |
| > | |
| <path | |
| d={metric.isIncrease ? "M5 15l7-7 7 7" : "M19 9l-7 7-7-7"} | |
| /> | |
| </svg> | |
| <p | |
| className="font-medium text-xs" | |
| style={{ color: metric.isIncrease ? "#f5f5f5" : "red" }} | |
| > | |
| {metric.percentage} | |
| </p> | |
| </div> | |
| </div> | |
| <p className="mt-1 font-semibold text-2xl text-[#f5f5f5]"> | |
| {metric.value} | |
| </p> | |
| </div> | |
| ); | |
| })} | |
| </div> | |
| <div className="flex flex-col justify-between mt-12"> | |
| <div> | |
| <h2 className="font-semibold text-[#f5f5f5] text-xl"> | |
| Item Details | |
| </h2> | |
| <p className="text-sm text-[#ababab]"> | |
| Lorem, ipsum dolor sit amet consectetur adipisicing elit. | |
| Distinctio, obcaecati? | |
| </p> | |
| </div> | |
| <div className="mt-6 grid grid-cols-4 gap-4"> | |
| { | |
| itemsData.map((item, index) => { | |
| return ( | |
| <div key={index} className="shadow-sm rounded-lg p-4" style={{ backgroundColor: item.color }}> | |
| <div className="flex justify-between items-center"> | |
| <p className="font-medium text-xs text-[#f5f5f5]">{item.title}</p> | |
| <div className="flex items-center gap-1"> | |
| <svg className="w-3 h-3 text-white" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="4" fill="none"> | |
| <path d="M5 15l7-7 7 7" /> | |
| </svg> | |
| <p className="font-medium text-xs text-[#f5f5f5]">{item.percentage}</p> | |
| </div> | |
| </div> | |
| <p className="mt-1 font-semibold text-2xl text-[#f5f5f5]">{item.value}</p> | |
| </div> | |
| ) | |
| }) | |
| } | |
| </div> | |
| </div> | |
| </div> | |
| ); | |
| }; | |
| export default Metrics; | |
| // RECENT ORDERS TABLE | |
| import React from "react"; | |
| import { orders } from "../../constants"; | |
| import { GrUpdate } from "react-icons/gr" | |
| const RecentOrders = () => { | |
| const handleStatusChange = () => {}; | |
| return ( | |
| <div className="container mx-auto bg-[#262626] p-4 rounded-lg"> | |
| <h2 className="text-[#f5f5f5] text-xl font-semibold mb-4"> | |
| Recent Orders | |
| </h2> | |
| <div className="overflow-x-auto"> | |
| <table className="w-full text-left text-[#f5f5f5]"> | |
| <thead className="bg-[#333] text-[#ababab]"> | |
| <tr> | |
| <th className="p-3">Order ID</th> | |
| <th className="p-3">Customer</th> | |
| <th className="p-3">Status</th> | |
| <th className="p-3">Date & Time</th> | |
| <th className="p-3">Items</th> | |
| <th className="p-3">Table No</th> | |
| <th className="p-3">Total</th> | |
| <th className="p-3 text-center">Action</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| {orders.map((order, index) => ( | |
| <tr | |
| key={index} | |
| className="border-b border-gray-600 hover:bg-[#333]" | |
| > | |
| <td className="p-4">#{order.id}</td> | |
| <td className="p-4">{order.customer}</td> | |
| <td className="p-4"> | |
| <select | |
| className={`bg-[#1a1a1a] text-[#f5f5f5] border border-gray-500 p-2 rounded-lg focus:outline-none ${ | |
| order.status === "Ready" | |
| ? "text-green-500" | |
| : "text-yellow-500" | |
| }`} | |
| value={order.status} | |
| onChange={(e) => handleStatusChange(index, e.target.value)} | |
| > | |
| <option className="text-yellow-500" value="In Progress"> | |
| In Progress | |
| </option> | |
| <option className="text-green-500" value="Ready"> | |
| Ready | |
| </option> | |
| </select> | |
| </td> | |
| <td className="p-4">{order.dateTime}</td> | |
| <td className="p-4">{order.items} Items</td> | |
| <td className="p-4">Table - {order.items}</td> | |
| <td className="p-4">₹{order.total.toFixed(2)}</td> | |
| <td className="p-4 text-center"> | |
| <button className="text-blue-400 hover:text-blue-500 transition"> | |
| <GrUpdate size={20} /> | |
| </button> | |
| </td> | |
| </tr> | |
| ))} | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> | |
| ); | |
| }; | |
| export default RecentOrders; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment