Skip to content

Commit

Permalink
Upgrade Docusaurus (#163)
Browse files Browse the repository at this point in the history
* update home friend links

* upgrade docusaurus version

* home docusaurus upgrade

* home docusaurus upgrade
  • Loading branch information
tomsun28 committed Jul 24, 2022
1 parent 8e2b0c8 commit 50433ef
Show file tree
Hide file tree
Showing 23 changed files with 4,958 additions and 6,202 deletions.
26 changes: 7 additions & 19 deletions home/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path')

const organizationName = 'usthe' // Usually your GitHub org/user name.
const organizationName = 'dromara' // Usually your GitHub org/user name.
const projectName = 'sureness' // Usually your repo name.
const branch = 'master'
const repoUrl = `https://github.com/dromara/${projectName}`
Expand All @@ -9,8 +9,8 @@ const cdnUrl = 'https://cdn.jsdelivr.net/gh/usthe/sureness@gh-pages/'
module.exports = {
title: 'Sureness',
tagline: 'Focus on Protection of API',
url: 'https://usthe.com',
baseUrl: '/sureness/',
url: 'https://su.usthe.com',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'throw',
favicon: cdnUrl + 'img/icon64.png',
Expand All @@ -32,19 +32,7 @@ module.exports = {
colorMode: {
defaultMode: 'light',
disableSwitch: false,
respectPrefersColorScheme: false,
switchConfig: {
darkIcon: '🌜',
lightIcon: '☀️',
// React inline style object
// see https://reactjs.org/docs/dom-elements.html#style
darkIconStyle: {
marginLeft: '2px',
},
lightIconStyle: {
marginLeft: '1px',
},
},
respectPrefersColorScheme: true
},
prism: {
theme: require('prism-react-renderer/themes/github'),
Expand All @@ -54,7 +42,7 @@ module.exports = {
algolia: {
apiKey: 'c7c84bfcc1495156f5730309d821ba8c',
indexName: 'sureness',
// appId: 'GNVT7Z0UI2',
appId: 'GNVT7Z0UI2',
contextualSearch: true,
},
announcementBar: {
Expand All @@ -63,7 +51,7 @@ module.exports = {
'<font style="font-size: medium; font-weight: bolder">If you like Sureness,</font> <a target="_blank" style="font-size: medium; font-weight: bolder" rel="noopener noreferrer" href="https://github.com/dromara/sureness">give us a star on GitHub </a> <font style="font-size: medium; font-weight: bolder"> or </font><a target="_blank" style="font-size: medium; font-weight: bolder" rel="noopener noreferrer" href="https://gitee.com/dromara/sureness">Gitee! </a>⭐️',
backgroundColor: '#7228B5',
textColor: '#fafbfc',
isCloseable: true,
isCloseable: true,
},
navbar: {
title: ' ',
Expand Down Expand Up @@ -205,7 +193,7 @@ module.exports = {
],
logo: {
alt: 'Open Source Logo',
src: cdnUrl + 'img/dromara.jpg',
src: cdnUrl + 'img/icon64.svg',
href: 'https://github.com/dromara',
},
copyright: `Apache License 2.0 | Copyright © ${new Date().getFullYear()}`,
Expand Down
27 changes: 14 additions & 13 deletions home/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,24 @@
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "^2.0.0-beta.0",
"@docusaurus/plugin-client-redirects": "^2.0.0-beta.0",
"@docusaurus/plugin-ideal-image": "^2.0.0-beta.0",
"@docusaurus/plugin-pwa": "^2.0.0-beta.0",
"@docusaurus/preset-classic": "^2.0.0-beta.0",
"@docusaurus/remark-plugin-npm2yarn": "^2.0.0-beta.0",
"@docusaurus/theme-search-algolia": "^2.0.0-beta.0",
"@docusaurus/theme-live-codeblock": "2.0.0-beta.0",
"@docusaurus/core": "^2.0.0-rc.1",
"@docusaurus/plugin-client-redirects": "^2.0.0-rc.1",
"@docusaurus/plugin-ideal-image": "^2.0.0-rc.1",
"@docusaurus/plugin-pwa": "^2.0.0-rc.1",
"@docusaurus/preset-classic": "^2.0.0-rc.1",
"@docusaurus/remark-plugin-npm2yarn": "^2.0.0-rc.1",
"@docusaurus/theme-search-algolia": "^2.0.0-rc.1",
"@docusaurus/theme-live-codeblock": "2.0.0-rc.1",
"@mdx-js/react": "^1.6.21",
"@svgr/webpack": "^5.5.0",
"clsx": "^1.1.1",
"clsx": "^1.2.1",
"color": "^3.1.3",
"file-loader": "^6.2.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"sharp": "^0.27.2",
"url-loader": "^4.1.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-slick": "^0.29.0",
"sharp": "^0.28.3",
"slick-carousel": "^1.8.1", "url-loader": "^4.1.1",
"workbox-routing": "^6.1.0",
"workbox-strategies": "^6.1.0"
},
Expand Down
64 changes: 62 additions & 2 deletions home/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@ export const friendLinks = [
img: 'satoken_logo.png',
alt: 'Sa-Token',
url: 'http://sa-token.dev33.cn/'
}, {
img: 'liteflow_logo.png',
alt: 'LiteFlow',
url: 'https://yomahub.com/liteflow/'
}, {
img: 'jpom_logo.png',
alt: 'jpom',
url: 'https://jpom.io/'
}, {
img: 'fast_request_logo.png',
alt: 'fast-request',
url: 'https://plugins.sheng90.wang/fast-request/'
}, {
img: 'justauth_logo.png',
alt: 'Justauth',
Expand All @@ -111,11 +123,59 @@ export const friendLinks = [
img: 'pha_logo.jfif',
alt: 'pha_api',
url: 'https://www.phalapi.net/'
}, {
img: 'hertzbeat_logo.svg',
alt: 'hertzbeat',
url: 'https://hertzbeat.com/'
}, {
img: 'koalas_rpc_logo.png',
alt: 'koalas_rpc',
url: 'https://gitee.com/dromara/koalas-rpc'
}, {
img: 'liteflow_logo.png',
alt: 'LiteFlow',
url: 'https://yomahub.com/liteflow/'
}
}, {
img: 'hmily_logo.png',
alt: 'hmily',
url: 'https://dromara.org/'
}, {
img: 'forest_logo.png',
alt: 'Forest',
url: 'https://forest.dtflyx.com/'
}, {
img: 'cubic_logo.png',
alt: 'cubic',
url: 'https://cubic.jiagoujishu.com/'
}, {
img: 'raincat_logo.png',
alt: 'Raincat',
url: 'https://dromara.org/'
}, {
img: 'easy_es_logo.png',
alt: 'easy-es',
url: 'https://www.easy-es.cn/'
}, {
img: 'dynamic_tp_logo.png',
alt: 'dynamic-tp',
url: 'https://dynamictp.cn/'
}, {
img: 'northstar_logo.png',
alt: 'northstar',
url: 'https://gitee.com/dromara/northstar'
}, {
img: 'mendmix_logo.png',
alt: 'mendmix',
url: 'https://www.jeesuite.com/'
}, {
img: 'gobrs_logo.png',
alt: 'Gobrs-Async',
url: 'https://async.sizegang.cn/'
}, {
img: 'easypdf_logo.png',
alt: 'easypdf',
url: 'https://dromara.gitee.io/x-easypdf/'
},
]

export const mediaPartners = [
Expand Down Expand Up @@ -253,4 +313,4 @@ export const SurenessIntegration = `
}
filterChain.doFilter(servletRequest, servletResponse);
}
`
`
102 changes: 31 additions & 71 deletions home/src/pages/components/LogoCarousel.js
Original file line number Diff line number Diff line change
@@ -1,96 +1,56 @@
import React from 'react'
import clsx from 'clsx'
import styles from './LogoCarousel.module.css'

const INTERVAL_LENGTH = 5000
const LOGO_WIDTH = 150
const cdnUrl = 'https://cdn.jsdelivr.net/gh/usthe/sureness@gh-pages/img/icons/'

let ticks = 0
import "slick-carousel/slick/slick.css";
import "slick-carousel/slick/slick-theme.css";
import Slider from "react-slick";

const cdnUrl = 'https://cdn.jsdelivr.net/gh/dromara/hertzbeat@gh-pages/img/icons/'

// const cdnUrl = '/img/icons/'

var settings = {
dots: false,
infinite: true,
speed: 800,
slidesToShow: 6,
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 800,
rows: 1,
vertical: false
};

export default class LogoCarousel extends React.Component {
constructor (props) {
super(props)
this.state = {
position: -0,
activePage: 0,
swapInterval: 0,
pages: Math.ceil(props.logos ? props.logos.length / 6 : 1),
margin: 70
}

this.imgUrl =

this.containerRef = React.createRef()
}

componentDidMount() {
const rect = this.containerRef.current.getBoundingClientRect()
const logosPerPage = Math.floor(rect.width / LOGO_WIDTH)
this.setState({
swapInterval: setInterval(this.nextPage.bind(this), INTERVAL_LENGTH),
pages: Math.ceil(this.props.logos ? this.props.logos.length / logosPerPage : 1),
margin: rect.width < 700 ? 0 : 70
})
}

componentWillUnmount () {
clearInterval(this.state.swapInterval)
}

animateTo (i) {
const width = this.containerRef.current.getBoundingClientRect().width - this.state.margin
const x = i * -width
this.setState({ position: x, activePage: i })
}

handleClick (i) {
this.animateTo(i)
clearInterval(this.state.swapInterval)
this.setState({
swapInterval: setInterval(this.nextPage.bind(this), INTERVAL_LENGTH)
})
}

nextPage () {
const pages = this.state.pages - 1
const direction = Math.floor(ticks / pages) % 2
this.animateTo(direction
? pages - (ticks % pages)
: ticks % pages
)
++ticks
}

render () {
if (!this.props || !this.props.logos) {
return (
<div></div>
<div/>
)
}

this.buttons = () => [...Array(this.state.pages)].map((_, index) => (
<button onClick={() => this.handleClick(index)} key={index} className={clsx(styles.button, index === this.state.activePage ? styles.buttonActive : '')}>{index + 1}</button>
))

this.list = () => (
<ul style={{ transform: `translate(${this.state.position}px, 0px)` }}>
<Slider {...settings}>
{this.props.logos.map((value, index) => (
<li key={index}><a href={value.url} target="_blank" rel="noopener noreferrer"><img src={cdnUrl + value.img} alt={value.alt} /></a></li>
<a key={index} href={value.url} target="_blank" rel="noopener noreferrer">
<img style={{ maxHeight: '80px', maxWidth: '100px' }} src={cdnUrl + value.img} alt={value.alt} />
</a>
))}
</ul>
</Slider>
)

return (
<div className={styles.companyUsage} ref={this.containerRef}>
<h3>{this.props.headerTitle}</h3>
<div className={clsx(styles.logos)}>
{this.list()}
<div className={styles.logoNavigation}>
{this.buttons()}
<>
<div className={styles.companyUsage} ref={this.containerRef}>
<h3>{this.props.headerTitle}</h3>
<div className={clsx(styles.logos)}>
{this.list()}
</div>
</div>
</div>
</>
)
}
}
8 changes: 4 additions & 4 deletions home/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,12 @@ function Home() {
/>
{/*Friend Links*/}
<Section>
<LogoCarousel logos={friendLinks} headerTitle={translate({message: 'Friend Links'})}></LogoCarousel>
<LogoCarousel logos={friendLinks} headerTitle={translate({message: 'Friend Links'})}/>
</Section>
{/*Media Partners*/}
<Section>
<LogoCarousel logos={mediaPartners} headerTitle={translate({message: 'Media Partners'})}></LogoCarousel>
</Section>
{/*<Section>*/}
{/* <LogoCarousel logos={mediaPartners} headerTitle={translate({message: 'Media Partners'})}></LogoCarousel>*/}
{/*</Section>*/}
</main>
</Layout>
)
Expand Down
Binary file added home/static/img/icons/cubic_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added home/static/img/icons/dromara.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added home/static/img/icons/dynamic_tp_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added home/static/img/icons/easy_es_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added home/static/img/icons/easypdf_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added home/static/img/icons/fast_request_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added home/static/img/icons/forest_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added home/static/img/icons/gobrs_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 50433ef

Please sign in to comment.