| 1 |
import { Cta } from '../Cta'; |
| 2 |
import { cardVariables, colorsOf } from '../colors'; |
| 3 |
import { DismissButton } from '../DismissButton'; |
| 4 |
|
| 5 |
export const Card = ({ |
| 6 |
notification, |
| 7 |
href, |
| 8 |
external, |
| 9 |
dismissible, |
| 10 |
onDismiss, |
| 11 |
onClick, |
| 12 |
}) => { |
| 13 |
const { title, content, image } = notification; |
| 14 |
const colors = colorsOf(notification); |
| 15 |
|
| 16 |
return ( |
| 17 |
<div |
| 18 |
className="relative h-full min-h-32 w-full rounded-sm border border-[#d1d5db] bg-(--ext-notification-card-main,#ffffff) px-5 py-5 text-base text-(--ext-notification-card-text,#1e1e1e) lg:px-8 lg:py-6" |
| 19 |
style={cardVariables(colors)} |
| 20 |
data-test="notification-card" |
| 21 |
> |
| 22 |
{dismissible && ( |
| 23 |
<DismissButton |
| 24 |
onClick={onDismiss} |
| 25 |
size={32} |
| 26 |
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" |
| 27 |
/> |
| 28 |
)} |
| 29 |
<div className="flex flex-col items-start gap-4"> |
| 30 |
{image && ( |
| 31 |
<img src={image} alt="" className="max-h-8 w-auto rounded-xs" /> |
| 32 |
)} |
| 33 |
<div> |
| 34 |
<div className="text-lg font-semibold">{title}</div> |
| 35 |
<div className="mt-1 text-sm">{content}</div> |
| 36 |
</div> |
| 37 |
<Cta |
| 38 |
notification={notification} |
| 39 |
href={href} |
| 40 |
external={external} |
| 41 |
onClick={onClick} |
| 42 |
surface="design" |
| 43 |
className="inline-flex h-10 cursor-pointer items-center rounded-xs bg-design-main px-4 text-sm text-design-text no-underline" |
| 44 |
/> |
| 45 |
</div> |
| 46 |
</div> |
| 47 |
); |
| 48 |
}; |
| 49 |
|