icon delivery method

This commit is contained in:
hamid zarghami
2025-12-22 15:48:02 +03:30
parent 15212e6429
commit f3cff014c7
@@ -1,7 +1,7 @@
'use client';
import Combobox from '@/components/combobox/Combobox';
import { Box } from 'iconsax-react';
import { Box, Location, Car, TruckTick, Building } from 'iconsax-react';
import { useTranslation } from 'react-i18next';
import { useGetShipmentMethod } from '../../hooks/useOrderData';
import { DeliveryMethod } from '../../types/Types';
@@ -24,13 +24,28 @@ export const ShippingSection = ({ deliveryType, onDeliveryTypeChange }: Shipping
return tOrders(`deliveryMethod.${translationKey}`);
};
const getDeliveryMethodIcon = (method: string) => {
switch (method) {
case 'dineIn':
return Building;
case 'pickup':
return Location;
case 'deliveryCar':
return Car;
case 'deliveryCourier':
return TruckTick;
default:
return Box;
}
};
const options = shipmentMethod?.data
.filter((item: DeliveryMethod) => item.enabled)
.sort((a: DeliveryMethod, b: DeliveryMethod) => a.order - b.order)
.map((item: DeliveryMethod) => ({
id: item.id,
title: getDeliveryMethodTranslation(item.method),
icon: Box
icon: getDeliveryMethodIcon(item.method)
})) || [];
return (