| 1 |
import { DismissButton } from '../DismissButton'; |
| 2 |
import { externalLinkProps } from '../notification-link'; |
| 3 |
|
| 4 |
export const Card = ({ notification, href, external, onDismiss, onClick }) => { |
| 5 |
const { title, content, image } = notification; |
| 6 |
const ctaLabel = notification['cta-label']; |
| 7 |
|
| 8 |
return ( |
| 9 |
<div |
| 10 |
className="relative h-full min-h-32 w-full rounded-sm border border-[#d1d5db] bg-white px-5 py-5 text-base text-gray-900 lg:px-8 lg:py-6" |
| 11 |
data-test="notification-card" |
| 12 |
> |
| 13 |
<DismissButton |
| 14 |
onClick={onDismiss} |
| 15 |
size={32} |
| 16 |
className="absolute right-0 top-0 flex h-8 w-8 items-center justify-center rounded-bl rounded-se bg-[#f3f4f6] p-1.5 text-center text-gray-900 hover:bg-[#d1d5db] rtl:left-0 rtl:right-auto rtl:rounded-bl-none rtl:rounded-br" |
| 17 |
/> |
| 18 |
<div className="flex flex-col items-start gap-4"> |
| 19 |
{image && ( |
| 20 |
<img src={image} alt="" className="max-h-8 w-auto rounded-xs" /> |
| 21 |
)} |
| 22 |
<div> |
| 23 |
<div className="text-lg font-semibold">{title}</div> |
| 24 |
<div className="mt-1 text-sm">{content}</div> |
| 25 |
</div> |
| 26 |
{ctaLabel && href && ( |
| 27 |
<a |
| 28 |
href={href} |
| 29 |
{...externalLinkProps(external)} |
| 30 |
onClick={onClick} |
| 31 |
className="inline-flex h-10 cursor-pointer items-center rounded-xs bg-design-main px-4 text-sm text-design-text no-underline hover:opacity-90" |
| 32 |
> |
| 33 |
{ctaLabel} |
| 34 |
</a> |
| 35 |
)} |
| 36 |
</div> |
| 37 |
</div> |
| 38 |
); |
| 39 |
}; |
| 40 |
|