Skip to content

Commit ea2e492

Browse files
committed
feat: added [fetch-databend-releases] plugin and refactor download pages
1 parent a5a8bf7 commit ea2e492

File tree

25 files changed

+1266
-446
lines changed

25 files changed

+1266
-446
lines changed

docs/doc/00-overview/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
title: Welcome
33
slug: /
44
---
5-
import GetLatest from '@site/src/components/GetLatest';
65

76
Welcome to the Databend documentation! Databend is an **open-source**, **elastic**, and **workload-aware** modern cloud data warehouse designed to meet businesses' massive-scale analytics needs at low cost and with low complexity.
87

docs/doc/03-develop/01-python.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ sidebar_label: Python
44
description:
55
Develop with Databend using Python.
66
---
7-
import GetLatest from '@site/src/components/GetLatest';
87

98
Databend offers the following options enabling you to develop applications using the Python programming language and establish connectivity with Databend:
109

website/docusaurus.config.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const config = {
3131
},
3232

3333
customFields: {
34-
blogTags: ['weekly','databend']
34+
blogTags: ['weekly','databend']
3535
},
3636

3737
presets: [
@@ -80,7 +80,8 @@ const config = {
8080
],
8181
plugins: [
8282
'docusaurus-plugin-sass',
83-
'./src/plugins/globalSassVarInject',
83+
'./src/plugins/global-sass-var-inject',
84+
'./src/plugins/fetch-databend-releases',
8485
[
8586
'@docusaurus/plugin-content-docs',
8687
/** @type {import('@docusaurus/plugin-content-docs').Options} */
@@ -179,4 +180,4 @@ const config = {
179180
}),
180181
};
181182

182-
module.exports = config;
183+
module.exports = config;

website/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,21 @@
2727
"bytes": "^3.1.2",
2828
"clsx": "^1.1.1",
2929
"copyforjs": "^1.0.6",
30+
"dayjs": "^1.11.7",
3031
"docusaurus-plugin-sass": "^0.2.1",
3132
"node": "^17.7.2",
3233
"prism-react-renderer": "^1.2.1",
3334
"rc-table": "^7.27.1",
3435
"rc-texty": "^0.2.0",
3536
"react": "^17.0.1",
3637
"react-dom": "^17.0.1",
38+
"react-markdown": "^8.0.5",
39+
"remark-gfm": "^3.0.1",
3740
"sass": "^1.45.0"
3841
},
3942
"devDependencies": {
4043
"@docusaurus/module-type-aliases": "^2.2.0",
4144
"@tsconfig/docusaurus": "^1.0.4",
42-
"postcss-px-to-viewport-8-plugin": "^1.1.3",
4345
"sass-resources-loader": "^2.2.4",
4446
"typescript": "^4.3.5"
4547
},
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright 2023 Datafuse Labs.
2+
import React from 'react';
3+
import { FC, ReactElement, ReactNode } from 'react';
4+
import styles from './styles.module.scss';
5+
import clsx from 'clsx';
6+
interface IProps {
7+
children: ReactNode;
8+
padding?: number[];
9+
className?: string;
10+
href?: string;
11+
isDownload?: boolean;
12+
style?: React.CSSProperties;
13+
}
14+
const Card: FC<IProps> = ({children, padding, className, href, isDownload, style}): ReactElement=> {
15+
const props = {
16+
style:{padding: `${padding[0]}px ${padding[1]}px`, ...style},
17+
className: clsx(styles.wrap, className)
18+
}
19+
return (
20+
<>
21+
{
22+
href
23+
? <a download={isDownload} href={href} {...props}>{children}</a>
24+
: <div {...props}>{children}</div>
25+
}
26+
</>
27+
);
28+
};
29+
Card.defaultProps = {
30+
padding: [28, 24],
31+
isDownload: false
32+
}
33+
export default Card;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.wrap {
2+
background-color: var(--color-fill-0);
3+
border: 1px solid var(--color-border);
4+
border-radius: 6px;
5+
display: block;
6+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2023 Datafuse Labs.
2+
import { FC, ReactElement, ReactNode } from 'react';
3+
import styles from './styles.module.scss';
4+
import React from 'react';
5+
import clsx from 'clsx';
6+
interface IProps {
7+
children: ReactNode;
8+
className?: string;
9+
}
10+
const Tag: FC<IProps> = ({children, className}): ReactElement=> {
11+
return (
12+
<span className={clsx(styles.tag, className)}>{children}</span>
13+
);
14+
};
15+
export default Tag;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.tag {
2+
display: inline-block;
3+
height: 20px;
4+
font-size: 14px;
5+
line-height: 20px;
6+
padding-left: 8px;
7+
padding-right: 8px;
8+
color: var(--color-white);
9+
background-color: var(--color-primary );
10+
border-radius: 100px;
11+
}

website/src/components/CustomBlog/BlogPostDetails.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const BlogPostNav = ({ nextPost, prevPost }) => {
3434
const BlogPostDetails = (props) => {
3535
const metadata = props.content.metadata;
3636
const BlogPostContent = props.content;
37+
console.log(BlogPostContent, 'BlogPostContent')
3738
return (
3839
<Layout title={`${metadata.title} | Blog`}>
3940
<section className={clsx("blog-page", styles.blogPage, styles.blogPost)}>
Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,43 @@
11
import React from "react";
2-
import { getLatest } from '@site/src/plugins/releaseVersion';
2+
import { useMount } from 'ahooks';
3+
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
4+
import { useGetReleases } from "@site/src/hooks/useGetReleases";
5+
import { copyToClipboard } from 'copyforjs';
6+
37
function GetLatest() {
4-
return (
5-
<>{getLatest()}</>
6-
)
8+
const {
9+
tagName
10+
} = useGetReleases();
11+
useMount(()=>{
12+
if (ExecutionEnvironment.canUseDOM) {
13+
setTimeout(()=>{
14+
setText();
15+
const dom = document.querySelectorAll('.clean-btn')
16+
for(let button of dom) {
17+
if (button?.getAttribute('aria-label') === 'Copy code to clipboard') {
18+
button.addEventListener("click", ()=>{
19+
setTimeout(()=>{
20+
let text = button?.previousSibling?.innerText;
21+
if (button?.parentNode?.previousSibling) {
22+
text = button?.parentNode?.previousSibling?.innerText;;
23+
}
24+
copyToClipboard(String(text).trim())
25+
}, 10)
26+
}, false);
27+
}
28+
}
29+
});
30+
}
31+
});
32+
function setText() {
33+
const name = tagName || 'v1.0.22-nightly';
34+
const dom = document.querySelectorAll('.variable');
35+
for (let div of dom){
36+
if (div.innerHTML === '${version}') {
37+
div.innerText = name;
38+
}
39+
}
40+
}
41+
return (<></>)
742
}
843
export default GetLatest;

0 commit comments

Comments
 (0)