diff --git a/docs/start/usage.md b/docs/start/usage.md index 6a2a0d76..a2be7491 100644 --- a/docs/start/usage.md +++ b/docs/start/usage.md @@ -9,7 +9,7 @@ sidebar_position: 1 ```java import java.util.List; import java.util.Arrays; -import io.fury.*; +import org.apache.fury.*; public class Example { public static void main(String[] args) { @@ -36,7 +36,7 @@ public class Example { ```java import com.google.common.collect.ImmutableMap; -import io.fury.*; +import org.apache.fury.*; import java.util.Map; diff --git a/src/components/HomePageLanguageCard/index.tsx b/src/components/HomePageLanguageCard/index.tsx deleted file mode 100644 index 39b3050e..00000000 --- a/src/components/HomePageLanguageCard/index.tsx +++ /dev/null @@ -1,79 +0,0 @@ -import React from "react"; -import { Card } from "antd"; - -export const HomePageLanguageCard = () => ( -
-
-

Quick Start!

-

Choose a language to get started .

-
- - { - window.location.href = - "https://fury.apache.org/docs/start/usage/#java-serialization"; - }}> - - Java - - { - window.location.href = - "https://fury.apache.org/docs/start/usage/#python"; - }}> - - Python - - { - window.location.href = - "https://fury.apache.org/docs/start/usage/#golang"; - }}> - - Golang - - { - window.location.href = - "https://fury.apache.org/docs/start/usage/#javascript"; - }}> - - JavaScript - - { - window.location.href = "https://fury.apache.org/docs/start/usage/#rust"; - }}> - - Rust - - { - window.location.href = - "https://fury.apache.org/docs/start/usage/#crosslanguage-serialization"; - }}> - - More - - -
-); - -const gridStyle: React.CSSProperties = { - width: "50%", - display: "flex", - alignItems: "center", - justifyContent: "center", - height: "100px", - textAlign: "center", - border: "1px solid #f0f0f0", - borderRadius: "10px", - fontWeight: "bold", - fontSize: "18px", -}; -const imageStyle: React.CSSProperties = { - width: "38px", - height: "38px", - marginRight: "8px", -}; diff --git a/src/components/HomepageCode/index.tsx b/src/components/HomepageCode.tsx similarity index 64% rename from src/components/HomepageCode/index.tsx rename to src/components/HomepageCode.tsx index f0f2fa95..972dad9d 100644 --- a/src/components/HomepageCode/index.tsx +++ b/src/components/HomepageCode.tsx @@ -1,8 +1,9 @@ -import React from "react"; +import React, { useState } from "react"; import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; import { dracula } from "react-syntax-highlighter/dist/esm/styles/prism"; export const HomepageCodeDisplay = () => { + const [copySuccess, setCopySuccess] = useState(""); const codeString = `import java.util.List; import java.util.Arrays; import org.apache.fury.*; @@ -28,6 +29,18 @@ public class Example { } `; + const copyToClipboard = () => { + navigator.clipboard.writeText(codeString).then( + () => { + setCopySuccess("Copied!"); + setTimeout(() => setCopySuccess(""), 2000); // 清除复制成功的提示 + }, + (err) => { + setCopySuccess("Failed to copy!"); + } + ); + }; + return ( <>
+ {/* 复制按钮 */} + + +
+ ); +} diff --git a/src/components/HomepageLanguageCard.tsx b/src/components/HomepageLanguageCard.tsx new file mode 100644 index 00000000..d7755572 --- /dev/null +++ b/src/components/HomepageLanguageCard.tsx @@ -0,0 +1,98 @@ +import React from "react"; +import { Card } from "antd"; + +export const HomepageLanguageCard = () => ( +
+
+

Quick Start!

+

Choose a language to get started .

+
+ + { + window.location.href = + "https://fury.apache.org/docs/start/usage/#java-serialization"; + }} + > + + Java + + { + window.location.href = + "https://fury.apache.org/docs/start/usage/#python"; + }} + > + + Python + + { + window.location.href = + "https://fury.apache.org/docs/start/usage/#golang"; + }} + > + + Golang + + { + window.location.href = + "https://fury.apache.org/docs/start/usage/#javascript"; + }} + > + + JavaScript + + { + window.location.href = + "https://fury.apache.org/docs/start/usage/#rust"; + }} + > + + Rust + + { + window.location.href = + "https://fury.apache.org/docs/start/usage/#crosslanguage-serialization"; + }} + > + + More + + +
+); + +const gridStyle: React.CSSProperties = { + width: "50%", + display: "flex", + alignItems: "center", + justifyContent: "center", + height: "100px", + textAlign: "center", + border: "1px solid #f0f0f0", + borderRadius: "10px", + fontWeight: "bold", + fontSize: "18px", +}; +const imageStyle: React.CSSProperties = { + width: "38px", + height: "38px", + marginRight: "8px", +}; diff --git a/src/components/HomepageFeatures/styles.module.css b/src/css/styles.module.css similarity index 100% rename from src/components/HomepageFeatures/styles.module.css rename to src/css/styles.module.css diff --git a/src/pages/index.tsx b/src/pages/index.tsx index abe4e9db..a1fc404e 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -9,8 +9,9 @@ import styles from "./index.module.css"; import Translate, { translate } from "@docusaurus/Translate"; import AOS from "aos"; import "aos/dist/aos.css"; -import { HomePageLanguageCard } from "../components/HomePageLanguageCard"; +import { HomepageLanguageCard } from "../components/HomePageLanguageCard"; import { HomepageCodeDisplay } from "../components/HomepageCode"; +import HomepageFoot from "../components/HomePageFoot"; function HomepageHeader() { const { siteConfig } = useDocusaurusContext(); @@ -103,7 +104,7 @@ export default function Home(): JSX.Element {
- +
@@ -111,7 +112,12 @@ export default function Home(): JSX.Element {
+
+
+ +
+
- ); + ); } diff --git a/static/JavaScript.svg b/static/JavaScript.svg index 326d4172..fb23ab59 100644 --- a/static/JavaScript.svg +++ b/static/JavaScript.svg @@ -1 +1,2 @@ - \ No newline at end of file + +