Skip to content

Commit 3f6632f

Browse files
authored
site 细节优化 (#543)
* 更新 README * 添加文档、上报问题、 v2 版本的底部导航 * 设置实现优化 * 优化底部导航布局 * deadline 初始化不使用上次的存储时间(容易过期) * 优化文档示例的位置 * 更好的命名 * 优化 html template * 设置卡片默认展开 * 移除多余的空行 * 重命名 OfficialSite => Copyright
1 parent b3a86c9 commit 3f6632f

File tree

7 files changed

+84
-13
lines changed

7 files changed

+84
-13
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ Qiniu-JavaScript-SDK 为客户端 SDK,没有包含 `token` 生成实现,为
4040

4141
Qiniu-JavaScript-SDK 的示例 [Demo](http://jssdk-v2.demo.qiniu.io) 中的服务器端部分是基于 [Node.js 服务器端 SDK](https://developer.qiniu.com/kodo/sdk/nodejs) 开发的。
4242

43-
* [JavaScript SDK 在线示例](http://jssdk-v2.demo.qiniu.io/)
43+
* [JavaScript SDK 在线示例 V3](https://js-sdk-demo.qiniu.io)
44+
* [JavaScript SDK 在线示例 V2](http://jssdk-v2.demo.qiniu.io)
4445

4546
<!--
4647
本 SDK 可使开发者忽略上传底层实现细节,而更多的关注 UI 层的展现。

site/src/components/App/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import classnames from './style.less'
1010

1111
export const App = () => {
1212
const [fileList, setFileList] = React.useState<UniqueFile[]>([])
13-
const [settingVisible, setSettingVisible] = React.useState(false)
13+
const [settingVisible, setSettingVisible] = React.useState(true)
1414

1515
const selectFile = (file: UniqueFile) => {
1616
setFileList(files => [file, ...files])

site/src/components/Input/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import * as React from 'react'
33
import classnames from './style.less'
44

55
interface IProps {
6-
value: string | undefined
7-
onChange(v: string | undefined): void
6+
value: string
7+
onChange(v: string): void
88

99
placeholder?: string | undefined
1010
}

site/src/components/Layout/index.tsx

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,50 @@ import * as React from 'react'
33
import qiniuLogo from './assets/logo.svg'
44
import classnames from './style.less'
55

6+
function Copyright() {
7+
return (
8+
<>
9+
© {new Date().getFullYear()} <a href="https://www.qiniu.com/" rel="noopener" target="_blank">七牛云</a>
10+
</>
11+
)
12+
}
13+
14+
function OfficialDoc() {
15+
return (
16+
<a
17+
rel="noopener"
18+
target="_blank"
19+
href="http://developer.qiniu.com/code/v6/sdk/javascript.html"
20+
>
21+
官方文档
22+
</a>
23+
)
24+
}
25+
26+
function Issue() {
27+
return (
28+
<a
29+
rel="noopener"
30+
target="_blank"
31+
href="https://github.com/qiniu/js-sdk/issues"
32+
>
33+
上报问题
34+
</a>
35+
)
36+
}
37+
38+
function V2Link() {
39+
return (
40+
<a
41+
rel="noopener"
42+
target="_blank"
43+
href="http://jssdk-v2.demo.qiniu.io"
44+
>
45+
V2版本
46+
</a>
47+
)
48+
}
49+
650
interface IProps { }
751

852
export function Layout(props: React.PropsWithChildren<IProps>) {
@@ -13,8 +57,10 @@ export function Layout(props: React.PropsWithChildren<IProps>) {
1357
{props.children}
1458
</div>
1559
<footer className={classnames.footer}>
16-
对象存储文件上传 DEMO
17-
© {new Date().getFullYear()} <a href="https://www.qiniu.com/" rel="noopener" target="_blank" >七牛云</a>
60+
对象存储文件上传 DEMO <Copyright />
61+
<OfficialDoc />
62+
<Issue />
63+
<V2Link />
1864
</footer>
1965
</>
2066
)

site/src/components/Layout/style.less

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,17 @@
1919
text-align: center;
2020

2121
a {
22-
color: #777;
22+
color: inherit;
23+
outline: none;
24+
}
25+
26+
a:hover {
27+
color: rgb(44, 178, 255);
2328
outline: none;
2429
text-decoration: none;
2530
}
31+
32+
a + a {
33+
margin-left: 0.5rem;
34+
}
2635
}

site/src/components/Settings/index.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ interface IProps { }
88

99
export function Settings(props: IProps) {
1010
const setting = React.useMemo(() => utils.loadSetting(), [])
11-
const [uphost, seUphost] = React.useState<string | undefined>(setting.uphost)
12-
const [deadline, setDeadline] = React.useState<number>(setting.deadline || 0)
13-
const [assessKey, setAssessKey] = React.useState<string | undefined>(setting.assessKey)
14-
const [secretKey, setSecretKey] = React.useState<string | undefined>(setting.secretKey)
15-
const [bucketName, setBucketName] = React.useState<string | undefined>(setting.bucketName)
11+
12+
const [deadline, setDeadline] = React.useState<number>(0)
13+
const [uphost, seUphost] = React.useState<string>(setting.uphost || '')
14+
const [assessKey, setAssessKey] = React.useState<string>(setting.assessKey || '')
15+
const [secretKey, setSecretKey] = React.useState<string>(setting.secretKey || '')
16+
const [bucketName, setBucketName] = React.useState<string>(setting.bucketName || '')
1617

1718
React.useEffect(() => {
1819
utils.saveSetting({

site/webpack.config.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ const HtmlWebpackPlugin = require('html-webpack-plugin')
44
const ESLintPlugin = require('eslint-webpack-plugin')
55
const WebpackBar = require('webpackbar')
66

7+
const htmlTemp = `
8+
<!DOCTYPE html>
9+
<html>
10+
<head>
11+
<title state-data-title="">七牛云 - JS SDK 示例 V3</title>
12+
<meta name="viewport" content="initial-scale=1.0,width=device-width,user-scalable=no">
13+
<link rel="shortcut icon" href="https://qiniu.staticfile.org/favicon.ico" type="image/vnd.microsoft.icon">
14+
</head>
15+
<body>
16+
<div id="root"></div>
17+
</body>
18+
</html>
19+
`
20+
721
module.exports = {
822
context: path.join(__dirname, 'src'),
923
devtool: 'source-map',
@@ -70,7 +84,7 @@ module.exports = {
7084

7185
plugins: [
7286
new HtmlWebpackPlugin({
73-
templateContent: '<!DOCTYPE html><html><body><div id="root"></div></body></html>',
87+
templateContent: htmlTemp,
7488
inject: 'head'
7589
}),
7690
new HotModuleReplacementPlugin(),

0 commit comments

Comments
 (0)