@pinnacle0/web-ui 0.4.32 → 0.4.33
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.
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "./index.less";
|
|
3
3
|
export interface Props {
|
|
4
|
-
height: number;
|
|
5
4
|
children: React.ReactNode;
|
|
6
5
|
className?: string;
|
|
7
6
|
styles?: React.CSSProperties;
|
|
@@ -11,4 +10,4 @@ export interface State {
|
|
|
11
10
|
hasShadowChildren: boolean;
|
|
12
11
|
paused: boolean;
|
|
13
12
|
}
|
|
14
|
-
export declare const VerticalMarquee: ({ className: extraClassName, speed,
|
|
13
|
+
export declare const VerticalMarquee: ({ className: extraClassName, speed, styles, children }: Props) => JSX.Element;
|
|
@@ -30,9 +30,11 @@ import { classNames } from "../../util/ClassNames";
|
|
|
30
30
|
import "./index.less";
|
|
31
31
|
import { ReactUtil } from "../../util/ReactUtil";
|
|
32
32
|
export var VerticalMarquee = ReactUtil.memo("VerticalMarquee", function (_a) {
|
|
33
|
-
var
|
|
34
|
-
var
|
|
33
|
+
var _b, _c;
|
|
34
|
+
var extraClassName = _a.className, speed = _a.speed, styles = _a.styles, children = _a.children;
|
|
35
|
+
var _d = __read(React.useState(0), 2), contentHeight = _d[0], setContentHeight = _d[1];
|
|
35
36
|
var animationSpeed = contentHeight / (speed || 30);
|
|
37
|
+
var containerRef = React.useRef(null);
|
|
36
38
|
var marqueeInnerRef = React.useCallback(function (node) {
|
|
37
39
|
if (!node) {
|
|
38
40
|
return;
|
|
@@ -43,10 +45,11 @@ export var VerticalMarquee = ReactUtil.memo("VerticalMarquee", function (_a) {
|
|
|
43
45
|
animation: "marquee ".concat(animationSpeed, "s linear infinite"),
|
|
44
46
|
transform: "translate(0, calc(-100% + ".concat(contentHeight / 2, "px))"),
|
|
45
47
|
}); }, [animationSpeed, contentHeight]);
|
|
46
|
-
var pageSize = contentHeight /
|
|
47
|
-
return (React.createElement("div", { className:
|
|
48
|
-
React.createElement("div", {
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
var pageSize = contentHeight / (((_b = containerRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 1);
|
|
49
|
+
return (React.createElement("div", { ref: containerRef, className: "g-marquee-container" },
|
|
50
|
+
React.createElement("div", { className: classNames("g-marquee", extraClassName), style: __assign(__assign({}, styles), { height: (_c = containerRef.current) === null || _c === void 0 ? void 0 : _c.offsetHeight }) },
|
|
51
|
+
React.createElement("div", { ref: marqueeInnerRef, className: "inner", style: pageSize > 1 ? marqueeInnerAnimationStyle : undefined },
|
|
52
|
+
children,
|
|
53
|
+
children))));
|
|
51
54
|
});
|
|
52
55
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/VerticalMarquee/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AACjD,OAAO,cAAc,CAAC;AACtB,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/VerticalMarquee/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AACjD,OAAO,cAAc,CAAC;AACtB,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAc/C,MAAM,CAAC,IAAM,eAAe,GAAG,SAAS,CAAC,IAAI,CAAC,iBAAiB,EAAE,UAAC,EAA2D;;QAA/C,cAAc,eAAA,EAAE,KAAK,WAAA,EAAE,MAAM,YAAA,EAAE,QAAQ,cAAA;IAC3G,I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