提交 0f0e74b3 编写于 作者: sinat_25235033's avatar sinat_25235033

[docs-home] add media partners

上级 c12831c2
...@@ -4,6 +4,7 @@ const organizationName = 'usthe' // Usually your GitHub org/user name. ...@@ -4,6 +4,7 @@ const organizationName = 'usthe' // Usually your GitHub org/user name.
const projectName = 'sureness' // Usually your repo name. const projectName = 'sureness' // Usually your repo name.
const branch = 'master' const branch = 'master'
const repoUrl = `https://github.com/dromara/${projectName}` const repoUrl = `https://github.com/dromara/${projectName}`
const cdnUrl = 'https://cdn.jsdelivr.net/gh/usthe/sureness@gh-pages/'
module.exports = { module.exports = {
title: 'Sureness', title: 'Sureness',
...@@ -16,14 +17,15 @@ module.exports = { ...@@ -16,14 +17,15 @@ module.exports = {
organizationName, organizationName,
projectName, projectName,
customFields: { customFields: {
repoUrl repoUrl,
cdnUrl
}, },
i18n: { i18n: {
defaultLocale: 'en', defaultLocale: 'en',
locales: ['en', 'zh-cn'], locales: ['en', 'zh-cn'],
}, },
themeConfig: { themeConfig: {
image: 'img/icon64128.png', image: 'img/icon128.png',
liveCodeBlock: { liveCodeBlock: {
playgroundPosition: 'bottom', playgroundPosition: 'bottom',
}, },
......
...@@ -267,5 +267,8 @@ ...@@ -267,5 +267,8 @@
}, },
"Friend Links": { "Friend Links": {
"message": "友情链接" "message": "友情链接"
},
"Media Partners": {
"message": "合作媒体"
} }
} }
\ No newline at end of file
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
}, },
"link.item.label.QQ Group - 390083213": { "link.item.label.QQ Group - 390083213": {
"message": "QQ 群 - 390083213", "message": "QQ 群 - 390083213",
"description": "The label of footer link with label=QQ Group - 282870345 linking to https://qm.qq.com/cgi-bin/qm/qr?k=3IpzQjFOztJe464_eMBmDHfT0YTWK5Qa&jump_from=webapi" "description": "The label of footer link with label=QQ Group - 390083213 linking to https://qm.qq.com/cgi-bin/qm/qr?k=3IpzQjFOztJe464_eMBmDHfT0YTWK5Qa&jump_from=webapi"
}, },
"link.item.label.Tom Blog": { "link.item.label.Tom Blog": {
"message": "Tom 博客", "message": "Tom 博客",
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
}, },
"item.label.QQ Group - 390083213": { "item.label.QQ Group - 390083213": {
"message": "QQ 群 - 390083213", "message": "QQ 群 - 390083213",
"description": "Navbar item with label QQ Group - 282870345" "description": "Navbar item with label QQ Group - 390083213"
}, },
"item.label.Blog": { "item.label.Blog": {
"message": "博客", "message": "博客",
......
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
export default function transfer(imageUrl) {
const {siteConfig} = useDocusaurusContext();
const {cdnUrl} = siteConfig.customFields;
if (cdnUrl !== null && imageUrl !== undefined && imageUrl !== null) {
return cdnUrl + imageUrl;
} else {
return imageUrl;
}
}
\ No newline at end of file
import React from 'react' import React from 'react'
import Translate, {translate} from '@docusaurus/Translate'; import Translate, {translate} from '@docusaurus/Translate'
export const features = [{ export const features = [{
title: translate({ title: translate({
...@@ -121,6 +122,14 @@ export const friendLinks = [ ...@@ -121,6 +122,14 @@ export const friendLinks = [
} }
] ]
export const mediaPartners = [
{
img: 'JavaHouDuan_logo.png',
alt: 'JavaHouDuan',
url: 'https://mp.weixin.qq.com/s/Ylq51a7Av8ZRuH811xZnDA'
}
]
export const logos = [{ export const logos = [{
/** /**
* Page 1 * Page 1
......
import React from 'react' import React from 'react'
import clsx from 'clsx' import clsx from 'clsx'
import useBaseUrl from '@docusaurus/useBaseUrl'
import styles from './Feature.module.css' import styles from './Feature.module.css'
import cdnTransfer from '../../CdnTransfer'
export default function Feature({ imageUrl, title, description }) { export default function Feature({ imageUrl, title, description }) {
const imgUrl = useBaseUrl(imageUrl) const imgUrl = cdnTransfer(imageUrl)
return ( return (
<div className={clsx('col col--4', styles.feature)}> <div className={clsx('col col--4', styles.feature)}>
{imgUrl && ( {imgUrl && (
......
...@@ -4,6 +4,7 @@ import styles from './LogoCarousel.module.css' ...@@ -4,6 +4,7 @@ import styles from './LogoCarousel.module.css'
const INTERVAL_LENGTH = 5000 const INTERVAL_LENGTH = 5000
const LOGO_WIDTH = 150 const LOGO_WIDTH = 150
const cdnUrl = 'https://cdn.jsdelivr.net/gh/usthe/sureness@gh-pages/img/icons/'
let ticks = 0 let ticks = 0
...@@ -18,6 +19,8 @@ export default class LogoCarousel extends React.Component { ...@@ -18,6 +19,8 @@ export default class LogoCarousel extends React.Component {
margin: 70 margin: 70
} }
this.imgUrl =
this.containerRef = React.createRef() this.containerRef = React.createRef()
} }
...@@ -73,7 +76,7 @@ export default class LogoCarousel extends React.Component { ...@@ -73,7 +76,7 @@ export default class LogoCarousel extends React.Component {
this.list = () => ( this.list = () => (
<ul style={{ transform: `translate(${this.state.position}px, 0px)` }}> <ul style={{ transform: `translate(${this.state.position}px, 0px)` }}>
{this.props.logos.map((value, index) => ( {this.props.logos.map((value, index) => (
<li key={index}><a href={value.url} target="_blank" rel="noopener noreferrer"><img src={'img/icons/' + value.img} alt={value.alt} /></a></li> <li key={index}><a href={value.url} target="_blank" rel="noopener noreferrer"><img src={cdnUrl + value.img} alt={value.alt} /></a></li>
))} ))}
</ul> </ul>
) )
......
...@@ -11,9 +11,10 @@ import Feature from './components/Feature' ...@@ -11,9 +11,10 @@ import Feature from './components/Feature'
import Section from './components/Section' import Section from './components/Section'
import Highlight from './components/Highlight' import Highlight from './components/Highlight'
import LogoCarousel from './components/LogoCarousel' import LogoCarousel from './components/LogoCarousel'
import cdnTransfer from '../CdnTransfer'
import styles from './styles.module.css' import styles from './styles.module.css'
import { features, SetupExample, SurenessIntegration, friendLinks } from '../constants' import { features, SetupExample, SurenessIntegration, friendLinks, mediaPartners } from '../constants'
function Home() { function Home() {
const context = useDocusaurusContext() const context = useDocusaurusContext()
...@@ -25,7 +26,7 @@ function Home() { ...@@ -25,7 +26,7 @@ function Home() {
<header className={clsx('hero hero--primary', styles.heroBanner)}> <header className={clsx('hero hero--primary', styles.heroBanner)}>
<div className="container"> <div className="container">
<h1 className="hero__title"> <h1 className="hero__title">
<img src="img/brand128.svg"/> <img src={cdnTransfer('img/brand128.svg')}/>
</h1> </h1>
<p className="hero__subtitle"><Translate>Focus on Protection of API</Translate></p> <p className="hero__subtitle"><Translate>Focus on Protection of API</Translate></p>
<div className={styles.social}> <div className={styles.social}>
...@@ -141,7 +142,7 @@ function Home() { ...@@ -141,7 +142,7 @@ function Home() {
<img <img
width="760" width="760"
height="445" height="445"
src="img/compare.png" src={cdnTransfer('img/compare.png')}
/> />
} }
isDark isDark
...@@ -200,7 +201,7 @@ function Home() { ...@@ -200,7 +201,7 @@ function Home() {
<img <img
width="560" width="560"
height="415" height="415"
src="img/benchmark_en.png" src={cdnTransfer('img/benchmark_en.png')}
/> />
} }
reversed reversed
...@@ -243,7 +244,7 @@ function Home() { ...@@ -243,7 +244,7 @@ function Home() {
<img <img
width="760" width="760"
height="405" height="405"
src="img/PathRoleMatcher.svg" src={cdnTransfer('img/PathRoleMatcher.svg')}
/> />
} }
isDark isDark
...@@ -303,6 +304,10 @@ function Home() { ...@@ -303,6 +304,10 @@ function Home() {
<Section> <Section>
<LogoCarousel logos={friendLinks} headerTitle={translate({message: 'Friend Links'})}></LogoCarousel> <LogoCarousel logos={friendLinks} headerTitle={translate({message: 'Friend Links'})}></LogoCarousel>
</Section> </Section>
{/*Media Partners*/}
<Section>
<LogoCarousel logos={mediaPartners} headerTitle={translate({message: 'Media Partners'})}></LogoCarousel>
</Section>
</main> </main>
</Layout> </Layout>
) )
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册