PluginProbe
Extendify / 3.2.1
Extendify v3.2.1
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 / Cta.jsx

Cta.jsx in Extendify 3.2.1, at src/Notifications/Cta.jsx

42 lines 740 B
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 bannerButtonVariables,
4 buttonHoverClasses,
5 colorsOf,
6 designButtonVariables,
7 } from './colors';
8 import { externalLinkProps } from './notification-link';
9
10 const VARIABLES = {
11 banner: bannerButtonVariables,
12 design: designButtonVariables,
13 };
14
15 export const Cta = ({
16 notification,
17 href,
18 external,
19 onClick,
20 surface,
21 className,
22 }) => {
23 const ctaLabel = notification['cta-label'];
24 if (!ctaLabel || !href) {
25 return null;
26 }
27
28 const colors = colorsOf(notification);
29
30 return (
31 <a
32 href={href}
33 {...externalLinkProps(external)}
34 onClick={onClick}
35 className={classNames(className, buttonHoverClasses(colors))}
36 style={VARIABLES[surface](colors)}
37 >
38 {ctaLabel}
39 </a>
40 );
41 };
42