add highlight logic to search card

This commit is contained in:
2025-05-29 13:07:49 +03:00
parent 2e820fb041
commit 91c6693190
4 changed files with 15 additions and 6 deletions

View File

@@ -45,6 +45,7 @@ const SearchCard = ({
formatted_arrival,
country_from_icon,
country_to_icon,
is_highlighted,
}: SearchCardProps) => {
const [isLeadPopupOpen, setIsLeadPopupOpen] = useState(false)
const { isAuthenticated } = useUserStore()
@@ -74,11 +75,18 @@ const SearchCard = ({
const userRequest = owner_type === 'customer' ? 'Нужен перевозчик' : 'Могу перевезти'
const getBorderColor = () => {
if (is_highlighted) {
return 'border-yellow-500 border-3'
}
return null
}
return (
<>
{/* десктоп */}
<div className="hidden sm:block">
<div className="my-4 w-full rounded-xl bg-white p-6 shadow-lg">
<div className={`my-4 w-full rounded-xl bg-white p-6 shadow-lg ${getBorderColor()}`}>
<div className="mb-4 flex items-center justify-between">
<div className="flex items-center gap-5">
<div className="flex h-16 w-16 items-center justify-center rounded-full bg-gray-200">
@@ -220,7 +228,7 @@ const SearchCard = ({
{/* мобилка */}
<div className="block sm:hidden">
<div className="my-4 w-full rounded-xl bg-white p-4 shadow-lg">
<div className={`my-4 w-full rounded-xl bg-white p-4 shadow-lg ${getBorderColor()}`}>
<div className="flex items-center justify-between">
<div className={`text-sm font-semibold ${getUserRequestStyles()}`}>{userRequest}</div>
<div className="text-sm font-semibold">