@rxdrag/website-lib-core 0.0.99 → 0.0.101

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.99",
3
+ "version": "0.0.101",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.ts"
@@ -24,9 +24,9 @@
24
24
  "@types/react-dom": "^19.1.0",
25
25
  "eslint": "^7.32.0",
26
26
  "typescript": "^5",
27
+ "@rxdrag/tsconfig": "0.2.0",
27
28
  "@rxdrag/eslint-config-custom": "0.2.12",
28
- "@rxdrag/slate-preview": "1.2.63",
29
- "@rxdrag/tsconfig": "0.2.0"
29
+ "@rxdrag/slate-preview": "1.2.63"
30
30
  },
31
31
  "dependencies": {
32
32
  "@iconify/utils": "^3.0.2",
@@ -36,8 +36,8 @@
36
36
  "lodash-es": "^4.17.21",
37
37
  "react": "^19.1.0",
38
38
  "react-dom": "^19.1.0",
39
- "@rxdrag/rxcms-models": "0.3.95",
40
- "@rxdrag/entify-lib": "0.0.23"
39
+ "@rxdrag/entify-lib": "0.0.23",
40
+ "@rxdrag/rxcms-models": "0.3.95"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "astro": "^4.0.0 || ^5.0.0"
@@ -110,7 +110,7 @@ export const Medias = forwardRef<HTMLDivElement, MediasProps>((props, ref) => {
110
110
  ref={ref}
111
111
  className={clsx(
112
112
  "flex gap-4",
113
- isVerticalThumbs ? "flex-row-reverse" : "flex-col",
113
+ isVerticalThumbs ? "flex-col md:flex-row-reverse" : "flex-col",
114
114
  className
115
115
  )}
116
116
  {...rest}
@@ -3,7 +3,7 @@ import { forwardRef, useRef, useEffect, useState } from "react";
3
3
 
4
4
  export type ToTopProps = {
5
5
  className?: string;
6
- children?: React.ReactNode;
6
+ svg?: string;
7
7
  };
8
8
 
9
9
  export const topIcon = () => (
@@ -25,28 +25,28 @@ export const topIcon = () => (
25
25
  );
26
26
 
27
27
  export const ToTop = forwardRef<HTMLDivElement, ToTopProps>((props, ref) => {
28
- const { className, children, ...rest } = props;
28
+ const { className, svg, ...rest } = props;
29
29
  const [win, setWin] = useState<Window | null>(null);
30
30
  const innerRef = useRef<HTMLDivElement>(null);
31
-
31
+
32
32
  // 合并外部传入的ref和内部ref
33
33
  useEffect(() => {
34
34
  if (!innerRef.current) return;
35
-
35
+
36
36
  // 获取当前元素所在的window
37
37
  const currentWin = innerRef.current.ownerDocument.defaultView;
38
38
  setWin(currentWin);
39
-
39
+
40
40
  // 如果外部传入的是ref对象,则设置其current属性
41
- if (ref && typeof ref === 'object') {
41
+ if (ref && typeof ref === "object") {
42
42
  ref.current = innerRef.current;
43
43
  }
44
44
  }, [ref]);
45
-
45
+
46
46
  const handleClick = () => {
47
47
  if (win) {
48
48
  win.scrollTo({ top: 0, behavior: "smooth" });
49
- } else if (typeof window !== 'undefined') {
49
+ } else if (typeof window !== "undefined") {
50
50
  // 降级处理:如果没有获取到特定window,使用全局window
51
51
  window.scrollTo({ top: 0, behavior: "smooth" });
52
52
  }
@@ -62,7 +62,11 @@ export const ToTop = forwardRef<HTMLDivElement, ToTopProps>((props, ref) => {
62
62
  {...rest}
63
63
  onClick={handleClick}
64
64
  >
65
- {children || topIcon()}
65
+ {svg ? (
66
+ <div className="contents" dangerouslySetInnerHTML={{ __html: svg }} />
67
+ ) : (
68
+ topIcon()
69
+ )}
66
70
  </div>
67
71
  );
68
72
  });
@@ -1,46 +0,0 @@
1
- import clsx from "clsx";
2
- import { forwardRef } from "react";
3
-
4
- export type ToTopProps = {
5
- className?: string;
6
- svg?: string;
7
- };
8
-
9
- export const ToTop = forwardRef<HTMLDivElement, ToTopProps>((props, ref) => {
10
- const { className, svg, ...rest } = props;
11
- const handleClick = () => {
12
- window.scrollTo({ top: 0, behavior: "smooth" });
13
- };
14
-
15
- return (
16
- <div
17
- ref={ref}
18
- className={clsx(
19
- "fixed bottom-4 right-4 hidden user-select-none scrolled:flex cursor-pointer transition duration-300 ease-in-out z-50",
20
- className
21
- )}
22
- {...rest}
23
- onClick={handleClick}
24
- >
25
- {svg ? (
26
- <div className="contents" dangerouslySetInnerHTML={{ __html: svg }} />
27
- ) : (
28
- <svg
29
- className="h-6 w-6"
30
- width="1.5rem"
31
- height="1.5rem"
32
- fill="none"
33
- viewBox="0 0 24 24"
34
- stroke="currentColor"
35
- >
36
- <path
37
- strokeLinecap="round"
38
- strokeLinejoin="round"
39
- strokeWidth={2}
40
- d="M5 15l7-7 7 7"
41
- />
42
- </svg>
43
- )}
44
- </div>
45
- );
46
- });