Skip to content

Commit 672fb83

Browse files
committed
[refactor] upgrade Cell Router & other packages
1 parent 4dcd9b6 commit 672fb83

File tree

5 files changed

+128
-126
lines changed

5 files changed

+128
-126
lines changed

ReadMe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Design of https://web-cell.dev/ is based on [Product][1] & [Carousel][2] templat
55
[![NPM Dependency](https://david-dm.org/EasyWebApp/EasyWebApp.github.io.svg)][3]
66
[![Build Status](https://travis-ci.com/EasyWebApp/EasyWebApp.github.io.svg?branch=source)][4]
77

8-
[1]: https://getbootstrap.com/docs/4.1/examples/product/
9-
[2]: https://getbootstrap.com/docs/4.1/examples/carousel/
8+
[1]: https://getbootstrap.com/docs/4.5/examples/product/
9+
[2]: https://getbootstrap.com/docs/4.5/examples/carousel/
1010
[3]: https://david-dm.org/EasyWebApp/EasyWebApp.github.io
1111
[4]: https://travis-ci.com/EasyWebApp/EasyWebApp.github.io

package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,23 @@
2121
},
2222
"dependencies": {
2323
"boot-cell": "^1.0.1",
24-
"bootstrap-icons": "^1.0.0-alpha5",
25-
"cell-router": "^2.0.0-rc.8",
24+
"bootstrap-icons": "^1.0.0",
25+
"cell-router": "^2.0.0",
2626
"classnames": "^2.2.6",
2727
"github-web-widget": "^3.0.0-beta.5",
2828
"koajax": "^0.6.2",
2929
"marked": "^1.1.1",
30-
"mobx": "^5.15.6",
31-
"mobx-web-cell": "^0.3.1",
3230
"prismjs": "^1.21.0",
3331
"web-cell": "^2.2.0",
3432
"web-utility": "^1.8.0"
3533
},
3634
"devDependencies": {
37-
"@babel/core": "^7.11.4",
35+
"@babel/core": "^7.11.6",
3836
"@types/classnames": "^2.2.10",
3937
"autoprefixer": "^9.8.6",
4038
"husky": "^4.2.5",
4139
"less": "^3.12.2",
42-
"lint-staged": "^10.2.13",
40+
"lint-staged": "^10.3.0",
4341
"parcel-bundler": "^1.12.4",
4442
"postcss-modules": "^3.2.2",
4543
"prettier": "^2.1.1",

source/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { serviceWorkerUpdate } from 'web-utility';
22
import { documentReady, render, createCell } from 'web-cell';
33

4-
import { PageRouter } from './page/Router';
4+
import { PageFrame } from './page/Router';
55

66
const { serviceWorker } = window.navigator;
77

@@ -18,5 +18,5 @@ serviceWorker?.addEventListener('controllerchange', () =>
1818
);
1919

2020
documentReady.then(() =>
21-
render(<PageRouter />, document.body.firstElementChild)
21+
render(<PageFrame />, document.body.firstElementChild)
2222
);

source/page/Router.tsx

Lines changed: 110 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { component, createCell, Fragment } from 'web-cell';
2-
import { observer } from 'mobx-web-cell';
3-
import { HTMLRouter } from 'cell-router/source';
1+
import { createCell, Fragment } from 'web-cell';
2+
import { CellRouter } from 'cell-router/source';
43
import { NavBar } from 'boot-cell/source/Navigator/NavBar';
54
import { NavLink } from 'boot-cell/source/Navigator/Nav';
65
import { isXDomain } from 'web-utility';
@@ -14,89 +13,76 @@ import { MainPage } from './Main';
1413
import { UpstreamPage } from './Upstream';
1514
import { CasePage } from './Case';
1615

17-
@observer
18-
@component({
19-
tagName: 'page-router',
20-
renderTarget: 'children'
21-
})
22-
export class PageRouter extends HTMLRouter {
23-
protected history = history;
24-
protected routes = [
25-
{ paths: [''], component: MainPage },
26-
{ paths: ['upstream'], component: UpstreamPage },
27-
{ paths: ['case'], component: CasePage }
28-
];
29-
30-
renderCopyright() {
31-
return (
32-
<>
16+
function Copyright() {
17+
return (
18+
<>
19+
<img
20+
className="d-block mb-2"
21+
style={{ maxWidth: '1.5rem' }}
22+
title="WebCell"
23+
src={WebCell_0}
24+
/>
25+
<small className="d-block mb-3 text-muted">
26+
&copy; 2018 - {new Date().getFullYear()}
27+
<a target="_blank" href="https://github.com/EasyWebApp">
28+
EasyWebApp team
29+
</a>
30+
</small>
31+
<a
32+
rel="license"
33+
target="_blank"
34+
href="http://creativecommons.org/licenses/by-nc-sa/4.0/"
35+
>
3336
<img
34-
className="d-block mb-2"
35-
style={{ maxWidth: '1.5rem' }}
36-
title="WebCell"
37-
src={WebCell_0}
37+
className="border-0"
38+
alt="知识共享许可协议"
39+
src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png"
3840
/>
39-
<small className="d-block mb-3 text-muted">
40-
&copy; 2018 - {new Date().getFullYear()}
41-
<a target="_blank" href="https://github.com/EasyWebApp">
42-
EasyWebApp team
43-
</a>
44-
</small>
41+
</a>
42+
<small className="d-none d-md-block">
43+
<span
44+
// xmlns:dct="http://purl.org/dc/terms/"
45+
property="dct:title"
46+
rel="dct:type"
47+
href="http://purl.org/dc/dcmitype/StillImage"
48+
>
49+
WebCell 标识
50+
</span>
51+
52+
<a
53+
// xmlns:cc="http://creativecommons.org/ns#"
54+
property="cc:attributionName"
55+
rel="cc:attributionURL"
56+
href="https://web-cell.dev/"
57+
>
58+
水歌 和 佳琦
59+
</a>
60+
采用
4561
<a
4662
rel="license"
4763
target="_blank"
48-
href="http://creativecommons.org/licenses/by-nc-sa/4.0/"
64+
href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh"
4965
>
50-
<img
51-
className="border-0"
52-
alt="知识共享许可协议"
53-
src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png"
54-
/>
66+
知识共享 署名-非商业性使用-相同方式共享 4.0 国际 许可协议
5567
</a>
56-
<small className="d-none d-md-block">
57-
<span
58-
// xmlns:dct="http://purl.org/dc/terms/"
59-
property="dct:title"
60-
rel="dct:type"
61-
href="http://purl.org/dc/dcmitype/StillImage"
62-
>
63-
WebCell 标识
64-
</span>
65-
66-
<a
67-
// xmlns:cc="http://creativecommons.org/ns#"
68-
property="cc:attributionName"
69-
rel="cc:attributionURL"
70-
href="https://web-cell.dev/"
71-
>
72-
水歌 和 佳琦
73-
</a>
74-
采用
75-
<a
76-
rel="license"
77-
target="_blank"
78-
href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh"
79-
>
80-
知识共享 署名-非商业性使用-相同方式共享 4.0 国际
81-
许可协议
82-
</a>
83-
进行许可。
84-
<br />
85-
基于
86-
<a
87-
// xmlns:dct="http://purl.org/dc/terms/"
88-
rel="dct:source"
89-
href="https://web-cell.dev/WebCell/"
90-
>
91-
https://web-cell.dev/WebCell/
92-
</a>
93-
上的作品创作。
94-
</small>
95-
</>
96-
);
97-
}
68+
进行许可。
69+
<br />
70+
基于
71+
<a
72+
// xmlns:dct="http://purl.org/dc/terms/"
73+
rel="dct:source"
74+
href="https://web-cell.dev/WebCell/"
75+
>
76+
https://web-cell.dev/WebCell/
77+
</a>
78+
上的作品创作。
79+
</small>
80+
</>
81+
);
82+
}
9883

99-
renderFooterList = ({ title, menu }: typeof footer[0]) => (
84+
function FooterList({ title, menu }: typeof footer[0]) {
85+
return (
10086
<div className="col-4 col-md">
10187
<h5>{title}</h5>
10288
<ul className="list-unstyled text-small">
@@ -114,46 +100,54 @@ export class PageRouter extends HTMLRouter {
114100
</ul>
115101
</div>
116102
);
103+
}
117104

118-
render() {
119-
return (
120-
<>
121-
<NavBar
122-
narrow
123-
menuAlign="around"
124-
brand={
125-
<img
126-
alt="WebCell"
127-
src={WebCell_0}
128-
style={{ width: '2rem' }}
129-
/>
130-
}
131-
>
132-
{header.map(({ title, ...rest }) => (
133-
<NavLink {...rest}>{title}</NavLink>
134-
))}
135-
</NavBar>
136-
137-
<main>{super.render()}</main>
105+
export function PageFrame() {
106+
return (
107+
<>
108+
<NavBar
109+
narrow
110+
menuAlign="around"
111+
brand={
112+
<img
113+
alt="WebCell"
114+
src={WebCell_0}
115+
style={{ width: '2rem' }}
116+
/>
117+
}
118+
>
119+
{header.map(({ title, ...rest }) => (
120+
<NavLink {...rest}>{title}</NavLink>
121+
))}
122+
</NavBar>
138123

139-
<hr className={style['featurette-divider']} />
124+
<CellRouter
125+
history={history}
126+
routes={[
127+
{ paths: [''], component: MainPage },
128+
{ paths: ['upstream'], component: UpstreamPage },
129+
{ paths: ['case'], component: CasePage }
130+
]}
131+
/>
132+
<hr className={style['featurette-divider']} />
140133

141-
<footer className="container py-5">
142-
<div className="row">
143-
<div className="col-6 col-md">
144-
{this.renderCopyright()}
145-
</div>
146-
<a
147-
className="col-6 col-md"
148-
target="_blank"
149-
href="https://jq.qq.com/?_wv=1027&amp;k=5he1Sw1"
150-
>
151-
<img src={EasyWebApp_QQ} title="QQ 群" />
152-
</a>
153-
{footer.map(this.renderFooterList)}
134+
<footer className="container py-5">
135+
<div className="row">
136+
<div className="col-6 col-md">
137+
<Copyright />
154138
</div>
155-
</footer>
156-
</>
157-
);
158-
}
139+
<a
140+
className="col-6 col-md"
141+
target="_blank"
142+
href="https://jq.qq.com/?_wv=1027&amp;k=5he1Sw1"
143+
>
144+
<img src={EasyWebApp_QQ} title="QQ 群" />
145+
</a>
146+
{footer.map(item => (
147+
<FooterList {...item} />
148+
))}
149+
</div>
150+
</footer>
151+
</>
152+
);
159153
}

source/page/data.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,16 @@ export const upstream = [
241241
repo: 'microbundle',
242242
issue: 711
243243
},
244+
{
245+
org: 'slune-org',
246+
repo: 'ts-transform-asset',
247+
issue: 2
248+
},
249+
{
250+
org: 'slune-org',
251+
repo: 'ts-transform-asset',
252+
issue: 3
253+
},
244254
{
245255
org: 'BuilderIO',
246256
repo: 'builder',

0 commit comments

Comments
 (0)