/* eslint-disable @next/next/no-img-element */ /* eslint-disable jsx-a11y/control-has-associated-label */ import Image from "next/image"; import type { PropsWithChildren } from "react"; import React, { createElement, Fragment } from "react"; import { useWindowSize } from "usehooks-ts"; import { Badge } from "@/components/ui/badge/badge"; import type { ButtonProps } from "@/components/ui/button/button"; import { Button } from "@/components/ui/button/button"; import LIcon from "@/components/ui/lucid-icon/lucid-icon"; import { Tooltip } from "@/components/ui/tooltip/tooltip"; import type { ITransferListItem } from "@/features/modules/transfer/list/types/transfer-list.types"; import { cn } from "@/libs/utils"; import DefautlImage from "@/public/assets/images/defaultImage.jpg"; interface TransferPriceProps { price: string; discountedPrice?: string; isOptimal?: boolean; } interface TransferDetailActionProps { onClick: () => void; buttonVariant?: ButtonProps["variant"]; buttonText?: string; isLoading?: boolean; } interface TransferInformationProps { transferName: string; maxPerson: string; time: string; isCompact?: boolean; } export interface TransferBrandProps { logoSrc?: string; } export interface TransferCardProps extends PropsWithChildren, React.HTMLAttributes {} const TransferCard = ({ children, ...props }: TransferCardProps) => { return (
{children}
); }; const TransferBrand = (props: { imageUrl: string }) => { return (
{props.imageUrl ? ( {props.imageUrl} ) : ( )}
); }; const TransferInformation = ({ transferName, maxPerson, time, isCompact, }: TransferInformationProps) => { return (
{transferName}
{maxPerson}
{time}
); }; const TransferPrice = ({ price, discountedPrice, isOptimal, }: TransferPriceProps) => { return (
{isOptimal && En uygun fiyat}
{discountedPrice} {price} Toplam Fiyat
); }; const TransferAction = ({ onClick, buttonVariant, buttonText, isLoading, }: TransferDetailActionProps) => { return ( ); }; export interface TransferListItemProps { onClick?: VoidFunction; item: ITransferListItem; isCompact?: boolean; noWrappedCard?: boolean; isLoading?: boolean; } const TransferListItemCard = ({ item, ...props }: TransferListItemProps) => { const windowSize = useWindowSize(); const isDesktop = windowSize.width > 640; const content = (
{!isDesktop &&
}
{!!props.onClick && ( { // eslint-disable-next-line no-console props.onClick?.(); }} /> )}
); return props.noWrappedCard ? createElement(Fragment, {}, content) : createElement( TransferCard, { onClick: props.onClick, }, content, ); }; export { TransferAction, TransferBrand, TransferCard, TransferInformation, TransferListItemCard, TransferPrice, };