-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: get latest version from GitHub
- Loading branch information
Showing
4 changed files
with
65 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,71 @@ | ||
import React from 'react'; | ||
import clsx from 'clsx'; | ||
import Link from '@docusaurus/Link'; | ||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; | ||
import Layout from '@theme/Layout'; | ||
import HomepageFeatures from '@site/src/components/HomepageFeatures'; | ||
import Layout from '@theme/Layout'; | ||
import clsx from 'clsx'; | ||
import React, { useEffect, useState } from 'react'; | ||
|
||
import Translate, {translate} from '@docusaurus/Translate'; | ||
import Translate, { translate } from '@docusaurus/Translate'; | ||
|
||
import styles from './index.module.css'; | ||
import config from '@generated/docusaurus.config'; | ||
import styles from './index.module.css'; | ||
|
||
function HomepageHeader() { | ||
const {siteConfig} = useDocusaurusContext(); | ||
return ( | ||
<header className={clsx('hero hero--primary', styles.heroBanner)}> | ||
<div className="container"> | ||
<img style={{width: 300, height: 100, objectFit: "cover"}} | ||
src={require('@site/static/img/logo.jpeg').default}/> | ||
<p className="hero__subtitle"> | ||
<Translate>Cloud Native Dev Environment</Translate> | ||
</p> | ||
<div className={styles.buttons}> | ||
<Link | ||
className="button button--secondary button--lg" | ||
to="/docs/quickstart"> | ||
<Translate>QuickStart</Translate> | ||
</Link> | ||
<Link | ||
className={styles.homepageVersion} | ||
to="https://github.com/kubenetworks/kubevpn/releases/tag/v2.2.1"> | ||
v2.2.1 | ||
</Link> | ||
</div> | ||
</div> | ||
</header> | ||
); | ||
const { siteConfig } = useDocusaurusContext(); | ||
|
||
const [ver, setVer] = useState('latest'); | ||
|
||
useEffect(() => { | ||
fetch( | ||
'https://raw.githubusercontent.com/kubenetworks/kubevpn/master/plugins/stable.txt', | ||
) | ||
.then(res => res.text()) | ||
.then(ver => setVer(ver)); | ||
}, []); | ||
|
||
return ( | ||
<header className={clsx('hero hero--primary', styles.heroBanner)}> | ||
<div className="container"> | ||
<img | ||
style={{ width: 300, height: 100, objectFit: 'cover' }} | ||
src={require('@site/static/img/logo.jpeg').default} | ||
/> | ||
<p className="hero__subtitle"> | ||
<Translate>Cloud Native Dev Environment</Translate> | ||
</p> | ||
<div className={styles.buttons}> | ||
<Link | ||
className="button button--secondary button--lg" | ||
to="/docs/quickstart" | ||
> | ||
<Translate>QuickStart</Translate> | ||
</Link> | ||
<Link | ||
className={styles.homepageVersion} | ||
to="https://github.com/kubenetworks/kubevpn/releases/latest" | ||
> | ||
{ver} | ||
</Link> | ||
</div> | ||
</div> | ||
</header> | ||
); | ||
} | ||
|
||
export default function Home(): React.JSX.Element { | ||
const {siteConfig} = useDocusaurusContext(); | ||
return ( | ||
<Layout | ||
title={translate({ | ||
message: "Homepage" | ||
})} | ||
description={config.tagline}> | ||
<HomepageHeader/> | ||
<main> | ||
<HomepageFeatures/> | ||
</main> | ||
</Layout> | ||
); | ||
const { siteConfig } = useDocusaurusContext(); | ||
|
||
return ( | ||
<Layout | ||
title={translate({ | ||
message: 'Homepage', | ||
})} | ||
description={config.tagline} | ||
> | ||
<HomepageHeader /> | ||
<main> | ||
<HomepageFeatures /> | ||
</main> | ||
</Layout> | ||
); | ||
} |