Skip to content

Commit 37da65c

Browse files
authored
feat: add marquee for provider advices (#2925)
1 parent 83c45c9 commit 37da65c

File tree

6 files changed

+103
-1
lines changed

6 files changed

+103
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"react-dom": "^19.1.0",
5555
"react-markdown": "^9.0.1",
5656
"react-scroll-progress-bar": "^2.0.3",
57+
"react-slick": "^0.31.0",
5758
"sass": "^1.77.8",
5859
"sass-resources-loader": "^2.2.5",
5960
"turndown": "^7.2.0",

src/css/theme.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,14 @@
209209
--indigo-5: rgb(94, 110, 195);
210210
--prism-color2: #393A34;
211211
--prism-background-color2: #fff;
212+
--scroll-banner-bg: rgb(243 248 255);
212213
::selection {
213214
color: #fff;
214215
background: var(--color-primary);
215216
cursor: none;
216217
outline: none;
217218
}
219+
218220
}
219221

220222
/* For readability concerns, you should choose a lighter palette in dark mode. */
@@ -410,6 +412,7 @@
410412
--indigo-5: rgb(63, 80, 180);
411413
--prism-color2: #F8F8F2;
412414
--prism-background-color2: #121a2a;
415+
--scroll-banner-bg: #121a2a;
413416
}
414417

415418
.cc--darkmode {

src/theme/DocPaginator/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import ThumbsDown from "./ThumbsDown.svg";
1515
import clsx from "clsx";
1616
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
1717
import { useLocation } from "@docusaurus/router";
18+
import ScrollBanner from "./scroll-banner";
1819
const { TextArea } = Input;
1920
function Alarm() {
2021
return (
@@ -162,7 +163,9 @@ export default function DocPaginator(props) {
162163
{$t("Raise issue")}
163164
</Button>
164165
</div>
166+
{isChina && <ScrollBanner />}
165167
</Spin>
168+
166169
<nav
167170
className="pagination-nav docusaurus-mt-lg"
168171
aria-label={translate({
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Copyright 2025 DatabendLabs.
2+
import { Flex } from "antd";
3+
import type { FC, ReactElement } from "react";
4+
import Slider from "react-slick";
5+
import styles from "./styles.module.scss";
6+
const ANNOUNCEMENTS = [
7+
"用户 ue**[email protected] 指出问题【注释与命令不符,拼写错误】,获得 Tshirt 一件",
8+
"用户 bo**[email protected] 提出建议【存储过程相关的文档过于分散】,获得定制魔方一个",
9+
"用户 7**[email protected] 指出问题【没看到 range + 时间方式的处理】,获得 Tshirt 一件",
10+
"用户 ty**ll@**.com 指出问题【404 找不到链接】,获得 Tshirt 一件",
11+
];
12+
13+
function Item({ text }: { text: string }) {
14+
return (
15+
<div style={{ height: "40px", lineHeight: "40px", paddingLeft: "20px" }}>
16+
<Flex
17+
align="center"
18+
gap={8}
19+
style={{
20+
height: "100%",
21+
whiteSpace: "nowrap",
22+
overflow: "hidden",
23+
textOverflow: "ellipsis",
24+
}}
25+
>
26+
<span
27+
style={{
28+
width: "6px",
29+
height: "6px",
30+
backgroundColor: "var(--color-primary)",
31+
display: "inline-block",
32+
borderRadius: "50%",
33+
}}
34+
></span>
35+
{text}
36+
</Flex>
37+
</div>
38+
);
39+
}
40+
41+
const ScrollBanner: FC = (): ReactElement => {
42+
const settings = {
43+
dots: false,
44+
infinite: true,
45+
speed: 500,
46+
slidesToShow: 1,
47+
slidesToScroll: 1,
48+
autoplay: true,
49+
autoplaySpeed: 3000,
50+
vertical: true,
51+
arrows: false,
52+
pauseOnHover: false,
53+
cssEase: "cubic-bezier(0.25, 1, 0.5, 1)",
54+
};
55+
56+
return (
57+
<div className={styles?.marquee}>
58+
<Slider {...settings}>
59+
{ANNOUNCEMENTS.map((text, index) => (
60+
<Item key={index} text={text} />
61+
))}
62+
</Slider>
63+
</div>
64+
);
65+
};
66+
67+
export default ScrollBanner;

src/theme/DocPaginator/styles.module.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,26 @@
9494

9595
.RaiseButton {
9696
margin-left: auto;
97+
background-color: var(--color-bg-1);
9798
color: var(--color-text-2);
9899
@media screen and (max-width: 500px) {
99100
display: none;
100101
}
101102
}
103+
104+
.marquee {
105+
width: 100%;
106+
height: 40px;
107+
overflow: hidden;
108+
background-color: var(--scroll-banner-bg);
109+
color: var(--color-text-2);
110+
border-radius: 4px;
111+
font-size: 14px;
112+
margin-top: 6px;
113+
@media screen and (max-width: 630px) {
114+
display: none;
115+
}
116+
@media screen and (min-width: 997px) and (max-width: 1168px) {
117+
display: none;
118+
}
119+
}

yarn.lock

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10807,6 +10807,16 @@ react-scroll-progress-bar@^2.0.3:
1080710807
resolved "https://registry.yarnpkg.com/react-scroll-progress-bar/-/react-scroll-progress-bar-2.0.3.tgz#f3b4847f408d3fc4d3bd9f60386cff8c441a461a"
1080810808
integrity sha512-CJ8L/X/oJMei6Pi3LaAG7seLahpdBc3CMNY+hhkmUUtPjND8W8Bva32OipESm2rj5ulkezym05DxKupeAjldzQ==
1080910809

10810+
react-slick@^0.31.0:
10811+
version "0.31.0"
10812+
resolved "https://registry.npmmirror.com/react-slick/-/react-slick-0.31.0.tgz#6b9c51b1a285acd6a5b7da70528c3a5429e86986"
10813+
integrity sha512-zo6VLT8wuSBJffg/TFPbzrw2dEnfZ/cUKmYsKByh3AgatRv29m2LoFbq5vRMa3R3A4wp4d8gwbJKO2fWZFaI3g==
10814+
dependencies:
10815+
classnames "^2.2.5"
10816+
json2mq "^0.2.0"
10817+
lodash.debounce "^4.0.8"
10818+
resize-observer-polyfill "^1.5.0"
10819+
1081010820
react@^19.1.0:
1081110821
version "19.1.0"
1081210822
resolved "https://registry.yarnpkg.com/react/-/react-19.1.0.tgz#926864b6c48da7627f004795d6cce50e90793b75"
@@ -11060,7 +11070,7 @@ requires-port@^1.0.0:
1106011070
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
1106111071
integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==
1106211072

11063-
resize-observer-polyfill@^1.5.1:
11073+
resize-observer-polyfill@^1.5.0, resize-observer-polyfill@^1.5.1:
1106411074
version "1.5.1"
1106511075
resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464"
1106611076
integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==

0 commit comments

Comments
 (0)