diff --git a/src/components/HomePage/Command/index.tsx b/src/components/HomePage/Command/index.tsx index 4849f2bc5d..a429c9c322 100644 --- a/src/components/HomePage/Command/index.tsx +++ b/src/components/HomePage/Command/index.tsx @@ -5,10 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -import React from "react"; +import React, { useState } from "react"; import { animated, useTrail } from "react-spring"; import CodeBlock from '@theme/CodeBlock'; import { Tabs, TabPane } from '@douyinfe/semi-ui'; +import {useWindowSize} from '@docusaurus/theme-common'; export default function Command() { @@ -21,10 +22,9 @@ export default function Command() { tension: 460, }, }) + const windowSize = useWindowSize(); + const tabPosition = windowSize === 'desktop' ? "left" : "top"; - const ScreenWidth = window.screen.width; - const tabPosition = ScreenWidth < 1000 ? "top" : "left"; - return ( diff --git a/src/components/HomePage/HowRainbond/index.tsx b/src/components/HomePage/HowRainbond/index.tsx index 3b044f5587..ef3d87f661 100644 --- a/src/components/HomePage/HowRainbond/index.tsx +++ b/src/components/HomePage/HowRainbond/index.tsx @@ -75,7 +75,7 @@ export default function HowRainbond() {
{Cards().map(({header, content, link},index) => ( -
+
diff --git a/src/components/HomePage/JoinCommunity/index.tsx b/src/components/HomePage/JoinCommunity/index.tsx index 891d5bc7ab..d56db6bd24 100644 --- a/src/components/HomePage/JoinCommunity/index.tsx +++ b/src/components/HomePage/JoinCommunity/index.tsx @@ -50,7 +50,7 @@ export default function JoinCommunity() { -
@@ -61,7 +61,7 @@ export default function JoinCommunity() { -
搜索钉钉群号 31096419 加入 Rainbond 钉钉技术交流群 diff --git a/src/components/HomePage/Users/index.tsx b/src/components/HomePage/Users/index.tsx index 76e1cd1b6c..321002f93a 100644 --- a/src/components/HomePage/Users/index.tsx +++ b/src/components/HomePage/Users/index.tsx @@ -125,8 +125,8 @@ export default function Users() {

我们的用户

- {Cards().map(({image}) => ( -
+ {Cards().map(({image},index) => ( +