@rxdrag/website-lib-core 0.0.104 → 0.0.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxdrag/website-lib-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.105",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.ts"
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"@types/react-dom": "^19.1.0",
|
|
25
25
|
"eslint": "^7.32.0",
|
|
26
26
|
"typescript": "^5",
|
|
27
|
-
"@rxdrag/slate-preview": "1.2.63",
|
|
28
27
|
"@rxdrag/tsconfig": "0.2.0",
|
|
28
|
+
"@rxdrag/slate-preview": "1.2.63",
|
|
29
29
|
"@rxdrag/eslint-config-custom": "0.2.12"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
@@ -1,41 +1,25 @@
|
|
|
1
1
|
import { Product } from "@rxdrag/rxcms-models";
|
|
2
2
|
import "./style.css";
|
|
3
|
-
import {
|
|
4
|
-
DATA_OPENABLE,
|
|
5
|
-
DATA_POPUP_CTA,
|
|
6
|
-
DATA_OPENABLE_ROLE,
|
|
7
|
-
popover,
|
|
8
|
-
OpenAble,
|
|
9
|
-
} from "../../../../controller";
|
|
10
|
-
import { useRef } from "react";
|
|
3
|
+
import type { ReactNode } from "react";
|
|
11
4
|
|
|
12
5
|
//TODO: 跟询盘触发器同样的实现原理,给询盘对话框发消息
|
|
13
6
|
export function ProductCta(props: {
|
|
14
7
|
product?: Product;
|
|
15
8
|
openableKey?: string;
|
|
16
|
-
children?:
|
|
9
|
+
children?: ReactNode;
|
|
17
10
|
}) {
|
|
18
11
|
const { product, openableKey = "enquiry-modal", children } = props;
|
|
19
|
-
const ref = useRef<HTMLButtonElement>(null);
|
|
20
12
|
const roleProps = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
[DATA_OPENABLE]: openableKey,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const handleClick = () => {
|
|
27
|
-
if (ref.current) {
|
|
28
|
-
popover.open(openableKey, ref.current);
|
|
29
|
-
}
|
|
13
|
+
"data-modal-open": openableKey,
|
|
14
|
+
"data-call-to-action": `From RichText ProductCard-${product?.title}-${product?.id}`,
|
|
30
15
|
};
|
|
31
16
|
|
|
32
17
|
return (
|
|
33
18
|
<div className="flex justify-center items-center">
|
|
34
19
|
<button
|
|
35
|
-
ref={ref}
|
|
36
20
|
{...roleProps}
|
|
37
21
|
className="product-cta-button relative flex-1 mt-2 flex items-center justify-center rounded-md border border-transparent bg-sky-600 text-md font-smibold text-white hover:bg-sky-700"
|
|
38
|
-
|
|
22
|
+
type="button"
|
|
39
23
|
>
|
|
40
24
|
{children || "Get a quote"}
|
|
41
25
|
</button>
|