import React from 'react'
import Image from 'next/image'
import Button from '@/components/ui/Button'
import { SearchCardProps } from '@/app/types/index'
const SearchCard = ({
id,
username,
userImg,
start_point,
country_from,
country_from_icon,
country_from_code,
end_point,
country_to,
country_to_icon,
country_to_code,
cargo_type,
user_request,
user_comment,
moving_type,
estimated_date,
day_out,
day_in,
}: SearchCardProps) => {
const getUserRequestStyles = () => {
if (user_request === 'Нужен перевозчик') {
return 'text-[#065bff]'
}
return 'text-[#45c226]'
}
const setMovingTypeIcon = () => {
if (moving_type === 'Авиатранспорт') {
return '/images/airplane.png'
}
return '/images/car.png'
}
return (
<>
{/* десктоп */}
{username}
|
{user_request}
Тип посылки: {cargo_type}
Объявление № {id}
{user_request === 'Нужен перевозчик' ? (
Забрать из:
) : (
Выезжаю из:
)}
{country_from_code}
{start_point} / {country_from}
{user_request === 'Могу перевезти' && (
Отправление:{' '}
{day_out?.toLocaleDateString()}
)}
{moving_type}
{user_request === 'Нужен перевозчик' && (
Дата доставки:{' '}
{estimated_date.toLocaleDateString()}
)}
{user_request === 'Нужен перевозчик' ? (
Доставить в:
) : (
Прибываю в:
)}
{country_to_code}
{end_point} / {country_to}
{user_request === 'Могу перевезти' && (
Прибытие:{' '}
{day_in?.toLocaleDateString()}
)}
{/* мобилка */}
{user_request}
Тип посылки: {cargo_type}
Объявление № {id}
{user_request === 'Нужен перевозчик' ? (
Забрать из:
) : (
Выезжаю из:
)}
{country_from_code}
{start_point} / {country_from}
{moving_type}
Дата доставки: {estimated_date.toLocaleDateString()}
{user_request === 'Нужен перевозчик' ? (
Доставить в:
) : (
Прибываю в:
)}
{country_to_code}
{end_point} / {country_to}
{user_request === 'Могу перевезти' && (
Прибытие:{' '}
{day_in?.toLocaleDateString()}
)}
>
)
}
export default SearchCard