improve: menu items visuals

This commit is contained in:
Mahyar Khanbolooki
2025-07-13 01:37:05 +03:30
parent a77a75eca4
commit 6c417f9725
2 changed files with 26 additions and 10 deletions
+21 -8
View File
@@ -6,7 +6,7 @@ import Image from "next/image";
import PlusIcon from "@/components/icons/PlusIcon"; import PlusIcon from "@/components/icons/PlusIcon";
import MinusIcon from "@/components/icons/MinusIcon"; import MinusIcon from "@/components/icons/MinusIcon";
import { useReceiptStore } from "@/zustand/receiptStore"; import { useReceiptStore } from "@/zustand/receiptStore";
import { motion } from "framer-motion";
interface MenuItemProps { interface MenuItemProps {
food: { food: {
id: number id: number
@@ -23,7 +23,7 @@ const MenuItem = ({ food }: MenuItemProps) => {
const decrement = useReceiptStore(state => state.decrement); const decrement = useReceiptStore(state => state.decrement);
return ( return (
<div className="flex gap-4 w-full"> <div className="flex gap-4 w-full h-full">
<Image <Image
className="rounded-xl w-28 h-28" className="rounded-xl w-28 h-28"
src={"/assets/images/food-preview.png"} src={"/assets/images/food-preview.png"}
@@ -31,7 +31,7 @@ const MenuItem = ({ food }: MenuItemProps) => {
width={100} width={100}
alt="Food image" alt="Food image"
/> />
<div className="w-full h-full inline-flex flex-col justify-between"> <div className="w-full inline-flex flex-col justify-between">
<div> <div>
<div className="text-sm2 font-medium">{food.name}</div> <div className="text-sm2 font-medium">{food.name}</div>
<div className="text-[#7F7F7F] text-xs leading-5 font-normal mt-2"> <div className="text-[#7F7F7F] text-xs leading-5 font-normal mt-2">
@@ -40,7 +40,10 @@ const MenuItem = ({ food }: MenuItemProps) => {
</div> </div>
<div className="inline-flex justify-between w-full items-end"> <div className="inline-flex justify-between w-full items-end">
<span className="w-full" dir="ltr">{food.price} T</span> <span className="w-full" dir="ltr">{food.price} T</span>
<div className="bg-background max-w-[115px] rounded-lg w-full h-8 inline-flex py-1 px-[5px] justify-between items-center gap-2"> <motion.div
whileTap={{ scale: 1.05 }}
className="bg-background active:drop-shadow-xs max-w-[115px] rounded-md w-full h-8 inline-flex p-1 justify-between items-center gap-2"
>
{quantity <= 0 ? ( {quantity <= 0 ? (
<button <button
onClick={() => increment(food.id)} onClick={() => increment(food.id)}
@@ -53,20 +56,30 @@ const MenuItem = ({ food }: MenuItemProps) => {
<> <>
<button <button
onClick={() => increment(food.id)} onClick={() => increment(food.id)}
className="bg-white rounded-sm p-2" className="bg-white hover:bg-white/60 active:bg-white/30 rounded-sm p-2"
> >
<PlusIcon /> <PlusIcon />
</button> </button>
<div className="text-sm2 pt-0.5 font-semibold">{quantity}</div> <motion.div
key={quantity}
initial={{ scale: 1 }}
animate={{ scale: [1.2, 0.95, 1] }}
transition={{ duration: 0.3 }}
className="text-sm2 pt-1 font-semibold"
>
{quantity}
</motion.div>
<button <button
onClick={() => decrement(food.id)} onClick={() => decrement(food.id)}
className="bg-white rounded-sm p-2" className="bg-white hover:bg-white/60 active:bg-white/30 rounded-sm p-2"
> >
<MinusIcon /> <MinusIcon />
</button> </button>
</> </>
)} )}
</div> </motion.div>
</div> </div>
</div> </div>
</div> </div>
+5 -2
View File
@@ -8,8 +8,11 @@ function MenuItemRendererComponent({ children, ...rest }: Props) {
return ( return (
<div <div
{...rest} {...rest}
className={`${rest.className} transition-all duration-200 ease-out w-full h-36 bg-white rounded-3xl px-4 pt-3.5 pb-3 flex justify-between gap-4`} className={`${rest.className} transition-all duration-200 ease-out w-full min-h-36 bg-white rounded-3xl px-4 flex items-center justify-between gap-4`}
> style={{
boxShadow: '0px 2px 16px 0px #00000014'
}}>
{children} {children}
</div> </div>
); );