This is an automated email from the ASF dual-hosted git repository.
dengliming pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu-website.git
The following commit(s) were added to refs/heads/main by this push:
new c1e23b4 add new download page, modify contributors for adding
dashboard and website's developer. (#289)
c1e23b4 is described below
commit c1e23b4153b80a2a0c8d14caec17ace924e334da
Author: YuI <[email protected]>
AuthorDate: Thu Sep 23 01:16:13 2021 +0800
add new download page, modify contributors for adding dashboard and
website's developer. (#289)
* add: wechat and qq's QR Code
* fix: the markdownline error
* fix: the markdownline error
* modift: Download button change into Github
* modift: Download markdown file name.
* add: new download page.
* modify: contributors add dashboard and website's developer.
Co-authored-by: 艺铭 <[email protected]>
---
community/10-contributors.mdx | 9 +-
docusaurus.config.js | 35 +++-----
.../current/10-contributors.mdx | 9 +-
package.json | 1 +
src/components/Contributors.tsx | 63 ++++++++------
src/pages/download/DownloadCard.tsx | 91 ++++++++++++++++++++
src/pages/download/downloadCard.module.css | 76 +++++++++++++++++
src/pages/download/index.module.css | 22 +++++
src/pages/download/index.tsx | 99 ++++++++++++++++++++++
9 files changed, 354 insertions(+), 51 deletions(-)
diff --git a/community/10-contributors.mdx b/community/10-contributors.mdx
index eb914d6..5b4783f 100644
--- a/community/10-contributors.mdx
+++ b/community/10-contributors.mdx
@@ -14,4 +14,11 @@ Hundreds of people have contributed articles and code to
Apache ShenYu so far, t
If you want to contribute, you can go to the [Apache
ShenYu](https://github.com/apache/incubator-shenyu/) and fork it.
-<Contributors />
+### [Apache ShenYu](https://github.com/apache/incubator-shenyu)
+<Contributors repo="apache/incubator-shenyu"/>
+
+### [Apache ShenYu
Dashboard](https://github.com/apache/incubator-shenyu-dashboard)
+<Contributors repo="apache/incubator-shenyu-dashboard"/>
+
+### [Apache ShenYu Website](https://github.com/apache/incubator-shenyu-website)
+<Contributors repo="apache/incubator-shenyu-website"/>
diff --git a/docusaurus.config.js b/docusaurus.config.js
index c7224c0..6a815fa 100755
--- a/docusaurus.config.js
+++ b/docusaurus.config.js
@@ -26,6 +26,18 @@ module.exports = {
},
},
},
+ customFields: {
+ downloads: [
+ {
+ name: "Apache ShenYu (incubating)",
+ description: "High-performance, multi-protocol, extensible, responsive
API Gateway",
+ githubRepo: "apache/incubator-shenyu",
+ version: "2.4.0",
+ releaseDate: "2021-08-08",
+ url: "https://dlcdn.apache.org/incubator/shenyu/2.4.0/"
+ }
+ ],
+ },
themeConfig: {
announcementBar: {
id: 'announcementBar-2', // Increment on change
@@ -38,7 +50,7 @@ module.exports = {
src: 'img/logo.png',
},
items: [
- {to: '/download/download-latest', label: 'Download', position: 'left'},
+ {to: '/download', label: 'Download', position: 'left'},
{
type: 'doc',
docId: 'index',
@@ -119,7 +131,7 @@ module.exports = {
items: [
{
label: 'Download',
- to: '/download/download-latest',
+ to: '/download',
},
{
label: 'Document',
@@ -227,25 +239,6 @@ module.exports = {
[
'@docusaurus/plugin-content-docs',
{
- id: 'download',
- path: 'download',
- routeBasePath: 'download',
- editUrl: ({locale, versionDocsDirPath, docPath}) => {
- if (locale !== 'en') {
- return
`https://github.com/apache/incubator-shenyu-website/edit/main/i18n/${locale}/${docPath}`;
- }
- return
`https://github.com/apache/incubator-shenyu-website/edit/main/${versionDocsDirPath}/${docPath}`;
- },
- editCurrentVersion: true,
- editLocalizedFiles: true,
- sidebarPath: require.resolve('./sidebarsCommunity.js'),
- showLastUpdateAuthor: true,
- showLastUpdateTime: true,
- }
- ],
- [
- '@docusaurus/plugin-content-docs',
- {
id: 'community',
path: 'community',
routeBasePath: 'community',
diff --git
a/i18n/zh/docusaurus-plugin-content-docs-community/current/10-contributors.mdx
b/i18n/zh/docusaurus-plugin-content-docs-community/current/10-contributors.mdx
index 3fab29f..23e73d6 100644
---
a/i18n/zh/docusaurus-plugin-content-docs-community/current/10-contributors.mdx
+++
b/i18n/zh/docusaurus-plugin-content-docs-community/current/10-contributors.mdx
@@ -14,4 +14,11 @@ import Contributors from '@site/src/components/Contributors';
想要参与贡献,可以直接去[Apache ShenYu](https://github.com/apache/incubator-shenyu/),并fork。
-<Contributors />
+### [Apache ShenYu](https://github.com/apache/incubator-shenyu)
+<Contributors repo="apache/incubator-shenyu"/>
+
+### [Apache ShenYu
Dashboard](https://github.com/apache/incubator-shenyu-dashboard)
+<Contributors repo="apache/incubator-shenyu-dashboard"/>
+
+### [Apache ShenYu Website](https://github.com/apache/incubator-shenyu-website)
+<Contributors repo="apache/incubator-shenyu-website"/>
diff --git a/package.json b/package.json
index 965d1cf..0493762 100755
--- a/package.json
+++ b/package.json
@@ -27,6 +27,7 @@
"prism-react-renderer": "^1.2.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
+ "react-icons": "^4.2.0",
"swiper": "^7.0.1",
"url-loader": "^4.1.1"
},
diff --git a/src/components/Contributors.tsx b/src/components/Contributors.tsx
index 898342b..1ab53b6 100644
--- a/src/components/Contributors.tsx
+++ b/src/components/Contributors.tsx
@@ -1,31 +1,38 @@
import React, { useState, useEffect } from 'react';
-export default () => {
- const [contributers, setContributers] = useState([]);
- useEffect(() => {
- if(!contributers || contributers.length === 0) {
-
fetch("https://api.github.com/repos/apache/incubator-shenyu/contributors?page=1&per_page=10000").then(function
(response) {
- return response.json();
- }).then((res)=>{
- setContributers(res);
- });
- }
- });
- let html = "<table>";
- if (contributers && Array.isArray(contributers)) {
- contributers.forEach((c, i) => {
- if (i % 5 === 0) {
- if (i > 0) {
- html += "</tr>"
- }
- html += "<tr>"
- }
- html += `<td><a href="${c.html_url}" target="_blank"><img
src="${c.avatar_url}" height="20" /> @${c.login}</a></td>`;
- if (i === contributers.length - 1) {
- html += "</tr>"
+export default (props) => {
+ const [contributers, setContributers] = useState([]);
+ useEffect(() => {
+ const repo = props.repo ?? 'apache/incubator-shenyu';
+
+ if (!contributers || contributers.length === 0) {
+
fetch(`https://api.github.com/repos/${repo}/contributors?page=1&per_page=10000`).then(function
(response) {
+ return response.json();
+ }).then((res) => {
+ setContributers(res);
+ });
}
- })
- }
- html+="</table>"
- return <div dangerouslySetInnerHTML={{__html: html}} />;
-}
\ No newline at end of file
+ });
+ let html = '<table>';
+ if (contributers && Array.isArray(contributers)) {
+ contributers.forEach((c, i) => {
+ if (i % 5 === 0) {
+ if (i > 0) {
+ html += '</tr>';
+ }
+ html += '<tr>';
+ }
+ html += `<td>
+ <a href="${c.html_url}" target="_blank">
+ <img src="${c.avatar_url}" height="20" />
+ <span style={{ whiteSpace: 'nowrap'
}}>@${c.login}</span>
+ </a>
+ </td>`;
+ if (i === contributers.length - 1) {
+ html += '</tr>';
+ }
+ });
+ }
+ html += '</table>';
+ return <div dangerouslySetInnerHTML={{ __html: html }}/>;
+}
diff --git a/src/pages/download/DownloadCard.tsx
b/src/pages/download/DownloadCard.tsx
new file mode 100644
index 0000000..2ddb7c5
--- /dev/null
+++ b/src/pages/download/DownloadCard.tsx
@@ -0,0 +1,91 @@
+import React, { useEffect, useState } from 'react';
+import { GoStar, GoIssueOpened, GoRepoForked } from 'react-icons/go';
+import { RiDownload2Fill } from 'react-icons/ri';
+import Translate, { translate } from '@docusaurus/Translate';
+import styles from './downloadCard.module.css';
+
+interface DownloadCardProps {
+ name?: string,
+ description?: string,
+ githubRepo?: string,
+ version?: string,
+ releaseDate?: string,
+ url?: string
+}
+
+interface RepoAttribute {
+ stars: number;
+ issues: number;
+ forks: number;
+}
+
+const DownloadCard: React.FC<DownloadCardProps> = ({ ...props }) => {
+
+ const [repo, setRepo] = useState<RepoAttribute>({
+ stars: 0,
+ issues: 0,
+ forks: 0
+ });
+
+ useEffect(() => {
+ getGitHubRepoStats(props.githubRepo).then((repo) => {
+ setRepo({
+ stars: repo.stargazers_count,
+ issues: repo.open_issues_count,
+ forks: repo.forks_count
+ });
+ });
+ }, []);
+
+ return (
+ <div className={styles.main}>
+ <div className={styles.githubDetail}>
+ <a target="_blank"
href={`https://github.com/apache/incubator-shenyu/${props.githubRepo}`}>
+ <h1>
+ {props.name}
+ </h1>
+ </a>
+ <p className={styles.githubMessage}>
+ {props.description}
+ </p>
+ <div className={styles.githubRepo}>
+ <div className={styles.githubRepoDetail}>
+ <GoStar/>
+ <span style={{ marginLeft: '4px' }}>{repo.stars}</span>
+ </div>
+ <div className={styles.githubRepoDetail} style={{
marginLeft: '20px' }}>
+ <GoIssueOpened/>
+ <span style={{ marginLeft: '4px'
}}>{repo.issues}</span>
+ </div>
+ <div className={styles.githubRepoDetail} style={{
marginLeft: '20px' }}>
+ <GoRepoForked/>
+ <span style={{ marginLeft: '4px' }}>{repo.forks}</span>
+ </div>
+ </div>
+ </div>
+ <div className={styles.downloadMessage}>
+ <div style={{ textAlign: 'right' }}>
+ <span>Version: {props.version}</span>
+ </div>
+ <div style={{ textAlign: 'right' }}>
+ <span>Release Date: {props.releaseDate}</span>
+ </div>
+ <a className={styles.downloadBtn} target="_blank"
href={props.url}>
+ <RiDownload2Fill/>
+ <span style={{ marginLeft: '6px' }}>Download</span>
+ </a>
+ </div>
+ </div>
+ );
+};
+
+const getGitHubRepoStats = (repo) => {
+ return fetch(`https://api.github.com/repos/${repo}`, {
+ headers: {
+ 'content-type': 'application/json',
+ Accept: 'application / vnd.github.v3 + json'
+ }
+ }).then((response) => response.json());
+};
+
+export default DownloadCard;
diff --git a/src/pages/download/downloadCard.module.css
b/src/pages/download/downloadCard.module.css
new file mode 100644
index 0000000..50a2e42
--- /dev/null
+++ b/src/pages/download/downloadCard.module.css
@@ -0,0 +1,76 @@
+.main {
+ width: 100%;
+ height: 240px;
+ border: #cecece solid 1px;
+ border-radius: 1rem;
+ display: flex;
+ overflow: hidden;
+}
+
+.main a:hover {
+ text-decoration: none;
+}
+
+.githubDetail {
+ width: 70%;
+ height: 100%;
+ padding: 30px 0 0 20px;
+}
+
+.githubDetail a {
+ color: black;
+}
+
+.githubDetail h1 {
+ height: 20%;
+ margin: 0;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ overflow: hidden;
+}
+
+.githubMessage {
+ display: inline-block;
+ width: 100%;
+ height: 40%;
+ padding: 0;
+ margin: 20px 0 0;
+ font-size: 20px;
+}
+
+.githubRepo {
+ height: 20%;
+ padding: 0;
+ font-size: 20px;
+ display: flex;
+}
+
+.githubRepoDetail {
+ display: flex;
+ align-items: center;
+}
+
+.downloadMessage {
+ width: 30%;
+ height: 100%;
+ padding: 80px 40px 0 0;
+}
+
+.downloadBtn {
+ width: 80%;
+ height: 50px;
+ margin-top: 20px;
+ border-radius: 1rem;
+ background: var(--ifm-color-primary);
+ display: flex;
+ font-size: 24px;
+ color: white;
+ justify-content: center;
+ align-items: center;
+ float: right;
+ position: relative;
+}
+
+.downloadBtn:hover {
+ color: white;
+}
diff --git a/src/pages/download/index.module.css
b/src/pages/download/index.module.css
new file mode 100644
index 0000000..a11565a
--- /dev/null
+++ b/src/pages/download/index.module.css
@@ -0,0 +1,22 @@
+.mainWrapper {
+ width: 100%;
+ margin: 4rem 0;
+ display: flex;
+ justify-content: center;
+}
+
+.articleWrapper {
+ width: 70%;
+}
+
+.moduleWrapper {
+ margin-top: 4rem;
+}
+
+.h1Wrapper {
+ font-size: 5em;
+}
+
+.h2Wrapper {
+ font-size: 2em;
+}
diff --git a/src/pages/download/index.tsx b/src/pages/download/index.tsx
new file mode 100644
index 0000000..3a96abd
--- /dev/null
+++ b/src/pages/download/index.tsx
@@ -0,0 +1,99 @@
+import * as React from 'react';
+import Layout from '@theme/Layout';
+import CodeBlock from '@theme/CodeBlock';
+import Translate, { translate } from '@docusaurus/Translate';
+import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
+import styles from './index.module.css';
+import DownloadCard from './DownloadCard';
+
+const Download: React.FC = () => {
+
+ const { siteConfig } = useDocusaurusContext();
+
+ if (!(siteConfig.customFields.downloads || []).length) {
+ return null;
+ }
+
+ const projects = siteConfig.customFields.downloads.map((project) => {
+ return <DownloadCard key={project.name} {...project} />;
+ });
+
+ return (
+ <Layout>
+ <main className={styles.mainWrapper}>
+ <article className={styles.articleWrapper}>
+ <h1 className={styles.h1Wrapper}>
+ <Translate>
+ Download
+ </Translate>
+ </h1>
+ <div className={styles.moduleWrapper}>
+ {projects}
+ </div>
+ <div className={styles.moduleWrapper}>
+ <h2 className={styles.h2Wrapper}>
+ <Translate>
+ Verify the Releases
+ </Translate>
+ </h2>
+ <a
href="https://downloads.apache.org/incubator/shenyu/KEYS">PGP signatures
KEYS</a>
+ <p>
+ It is essential that you verify the integrity of
the downloaded files using the PGP or SHA
+ signatures.
+ The PGP signatures can be verified using GPG or
PGP.
+ Please download the KEYS as well as the asc
signature files for relevant distribution.
+ It is recommended to get these files from the main
distribution directory and not from the
+ mirrors.
+ </p>
+ <CodeBlock>
+ gpg -i KEYS
+ </CodeBlock>
+ <p>
+ or
+ </p>
+ <CodeBlock>
+ pgpk -a KEYS
+ </CodeBlock>
+ <p>
+ or
+ </p>
+ <CodeBlock>
+ pgp -ka KEYS
+ </CodeBlock>
+ <p>
+ To verify the binaries/sources you can download
the relevant asc files for it from main
+ distribution directory and follow the below guide.
+ </p>
+ <CodeBlock>
+ gpg --verify apache-shenyu-********.asc
apache-shenyu-*********
+ </CodeBlock>
+ <p>
+ or
+ </p>
+ <CodeBlock>
+ pgpv apache-shenyu-********.asc
+ </CodeBlock>
+ <p>
+ or
+ </p>
+ <CodeBlock>
+ pgp apache-shenyu-********.asc
+ </CodeBlock>
+ </div>
+ <div className={styles.moduleWrapper}>
+ <h2 className={styles.h2Wrapper}>
+ PDF
+ </h2>
+ <p>
+ <b>Apache ShenYu (incubating)</b> provides a
packaged and
+ downloaded <b>PDF</b> of the docs
+ for users and developers to use.
+ </p>
+ </div>
+ </article>
+ </main>
+ </Layout>
+ );
+};
+
+export default Download;