PluginProbe
Extendify / 3.1.6
Extendify v3.1.6
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / Notifications / templates / Card.jsx

Card.jsx in Extendify 3.1.6, at src/Notifications/templates/Card.jsx

62 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import classNames from 'classnames';
2 import {
3 buttonHoverClasses,
4 cardVariables,
5 colorsOf,
6 designButtonVariables,
7 } from '../colors';
8 import { DismissButton } from '../DismissButton';
9 import { externalLinkProps } from '../notification-link';
10
11 export const Card = ({
12 notification,
13 href,
14 external,
15 dismissible,
16 onDismiss,
17 onClick,
18 }) => {
19 const { title, content, image } = notification;
20 const ctaLabel = notification['cta-label'];
21 const colors = colorsOf(notification);
22
23 return (
24 <div
25 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"
26 style={cardVariables(colors)}
27 data-test="notification-card"
28 >
29 {dismissible && (
30 <DismissButton
31 onClick={onDismiss}
32 size={32}
33 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"
34 />
35 )}
36 <div className="flex flex-col items-start gap-4">
37 {image && (
38 <img src={image} alt="" className="max-h-8 w-auto rounded-xs" />
39 )}
40 <div>
41 <div className="text-lg font-semibold">{title}</div>
42 <div className="mt-1 text-sm">{content}</div>
43 </div>
44 {ctaLabel && href && (
45 <a
46 href={href}
47 {...externalLinkProps(external)}
48 onClick={onClick}
49 className={classNames(
50 'inline-flex h-10 cursor-pointer items-center rounded-xs bg-design-main px-4 text-sm text-design-text no-underline',
51 buttonHoverClasses(colors),
52 )}
53 style={designButtonVariables(colors)}
54 >
55 {ctaLabel}
56 </a>
57 )}
58 </div>
59 </div>
60 );
61 };
62