import { formatIDR } from '@/utils' import { HiClipboardDocumentList, HiShare } from 'react-icons/hi2' import { toast } from 'react-toastify' export default function VoucherCard(props) { const { item: { voucher, quantity, share_word }, } = props const handleShare = () => { console.log(share_word) if (navigator.canShare) { navigator.share({ title: share_word, text: share_word, }) return } navigator.clipboard.writeText(share_word) toast.info('copied to clipboard') return } const handleCopyToClipboard = (text) => { toast.info('copied to clipboard') navigator.clipboard.writeText(text) } return (
{voucher.location.name}
{voucher.profile}
IDR {formatIDR(voucher.price)}
{+voucher.discount !== 0 && (
{voucher.discount}%
{formatIDR(voucher.display_price)}
)}
{voucher.display_quota}
{voucher.display_expired}
Username :
{voucher.username}
handleCopyToClipboard(voucher.username) } >
Password :
{voucher.password}
handleCopyToClipboard(voucher.password) } >
handleShare()} >
Share
) }