Skip to content

Commit 7c0197a

Browse files
committed
refactor: switch to react
1 parent fa075f6 commit 7c0197a

File tree

65 files changed

+647
-529
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+647
-529
lines changed

packages/taro-ui-docs/app.jsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import * as Nerv from 'nervjs'
1+
import React from 'react'
2+
import ReactDOM from 'react-dom'
23
import { HashRouter as Router, Switch, Route } from 'react-router-dom'
34

45
import 'at-ui-style'
@@ -7,24 +8,24 @@ import Index from './pages/index.jsx'
78
import Docs from './pages/docs.jsx'
89
import Guide from './pages/guide.jsx'
910

10-
class App extends Nerv.Component {
11-
constructor (...args) {
11+
class App extends React.Component {
12+
constructor(...args) {
1213
super(...args)
1314
this.state = {
1415
visible: false
1516
}
1617
}
17-
componentDidMount () {
18+
componentDidMount() {
1819
this.setState({
1920
visible: true
2021
})
2122
}
22-
23-
shouldComponentUpdate () {
23+
24+
shouldComponentUpdate() {
2425
return true
2526
}
2627

27-
render () {
28+
render() {
2829
return (
2930
<div className='wrapper' style={{ backgroundColor: '#F8FAFF' }}>
3031
<Switch>
@@ -37,8 +38,8 @@ class App extends Nerv.Component {
3738
}
3839
}
3940

40-
Nerv.render(
41-
<Router >
41+
ReactDOM.render(
42+
<Router>
4243
<App />
4344
</Router>,
4445
document.getElementById('container')
Lines changed: 173 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,183 @@
1-
import * as Nerv from 'nervjs'
1+
import React from 'react'
22
import './style.scss'
33

4-
const Footer = () => {
5-
return (
6-
<footer className='footer' id='footer'>
7-
<div className='grid_c1 footer_cont'>
8-
<div className='footer_logo_container'>
9-
<div className='footer_logo' />
10-
<span className='footer_designedby' />
4+
const Footer = () => (
5+
<footer className='footer' id='footer'>
6+
<div className='grid_c1 footer_cont'>
7+
<div className='footer_logo_container'>
8+
<div className='footer_logo' />
9+
<span className='footer_designedby' />
10+
</div>
11+
<div className='footer_link_container'>
12+
<div className='footer_link'>
13+
<h3 className='footer_link_tit footer_link_tit1'>相关资源</h3>
14+
<p>
15+
<a
16+
className='link'
17+
href='https://taro.jd.com/'
18+
target='_blank'
19+
rel='noopener noreferrer'
20+
>
21+
Taro
22+
</a>
23+
</p>
24+
<p>
25+
<a
26+
className='link'
27+
href='https://taro-ui.jd.com/'
28+
target='_blank'
29+
rel='noopener noreferrer'
30+
>
31+
Taro UI
32+
</a>
33+
</p>
34+
<p>
35+
<a
36+
className='link'
37+
href='https://at-ui.github.io/at-ui/#/zh'
38+
target='_blank'
39+
rel='noopener noreferrer'
40+
>
41+
At-UI
42+
</a>
43+
</p>
44+
<p>
45+
<a
46+
className='link'
47+
href='https://nerv.aotu.io/'
48+
target='_blank'
49+
rel='noopener noreferrer'
50+
>
51+
Nerv
52+
</a>
53+
</p>
54+
<p>
55+
<a
56+
className='link'
57+
href='https://athena.aotu.io/'
58+
target='_blank'
59+
rel='noopener noreferrer'
60+
>
61+
Athena
62+
</a>
63+
</p>
1164
</div>
12-
<div className='footer_link_container'>
13-
<div className='footer_link'>
14-
<h3 className='footer_link_tit footer_link_tit1'>相关资源</h3>
15-
<p><a className='link' href='https://taro.jd.com/' target='_blank'>Taro</a></p>
16-
<p><a className='link' href='https://taro-ui.jd.com/' target='_blank'>Taro UI</a></p>
17-
<p><a className='link' href='https://at-ui.github.io/at-ui/#/zh' target='_blank'>At-UI</a></p>
18-
<p><a className='link' href='https://nerv.aotu.io/' target='_blank'>Nerv</a></p>
19-
<p><a className='link' href='https://athena.aotu.io/' target='_blank'>Athena</a></p>
20-
</div>
21-
<div className='footer_link'>
22-
<h3 className='footer_link_tit footer_link_tit2'>社区</h3>
23-
<p><a href='https://github.com/NervJS/taro/issues' target='_blank'>GitHub</a></p>
24-
<p><a href='https://taro-club.jd.com' target='_blank'>Taro BBS</a></p>
25-
<p className='footer_link_connect_wrap'>
26-
<span className='footer_link_connect footer_link_wechat'>微信<span className='wechat_qrcode_icon'>
27-
<svg t='1554966525626' className='icon svgicon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='2588' data-spm-anchor-id='a313x.7781069.0.i0'>
28-
<path d='M240.071 241.095h59.278v59.278h-59.278v-59.278z' fill='' p-id='2589' />
29-
<path d='M405.959 134.485h-272.611v272.611h106.723v47.445h59.278v-47.445h106.723v-59.278h47.445v-47.445h-47.445l-0.114-165.888zM346.795 347.819h-154.169v-154.055h154.055v154.055h0.114zM240.071 727.154h59.278v59.278h-59.278v-59.278zM726.016 241.095h59.278v59.278h-59.278v-59.278zM512.683 509.042v63.943h59.278v-59.165h47.445v-59.278h-47.445v-47.445h-59.278v101.945zM512.683 725.789v60.643h59.278v-106.723h47.445v-59.278h-106.723v105.358zM571.961 786.432h47.445v47.445h-47.445v-47.445zM453.405 833.877v59.165h118.557v-59.165h-118.557z' fill='' p-id='2590' />
30-
<path d='M678.685 679.709h-59.278v106.723h106.61v-59.278h-47.331v-47.445zM726.016 893.042h166.002v-59.165h-106.723v-47.445h-59.278v106.61zM892.018 513.821v-59.278h-106.723v59.278h106.723zM832.739 727.154h59.278v59.278h-59.278v-59.278zM453.405 347.819h59.278v59.278h-59.278v-59.278zM726.016 454.542v-47.445h166.002v-272.611h-272.611v59.278h-106.723v47.445h106.723v59.165h-47.445v47.445h47.445v59.278h59.278v47.445h47.331zM678.685 193.763h154.055v154.055h-154.055v-154.055zM678.685 572.985h47.331v47.445h-47.331v-47.445zM785.294 679.709h-59.278v47.445h106.723v-106.723h59.278v-47.445h-106.723v106.723zM453.405 241.095h59.278v59.278h-59.278v-59.278zM299.349 513.821h47.445v59.165h-47.445v-59.165zM453.405 454.542h-106.61v59.278h59.165v59.165h47.445v-118.443z' fill='' p-id='2591' />
31-
<path d='M405.959 786.432v-106.723h47.445v-59.278h-213.333v-106.61h-106.723v59.278h59.278v47.445h-59.278v272.611h272.611v-59.278h47.445v-47.445h-47.445zM346.795 833.877h-154.169v-154.169h154.055v154.169h0.114zM453.405 572.985h59.278v47.445h-59.278v-47.445zM619.406 513.821h59.278v59.165h-59.278v-59.165zM726.016 513.821h59.278v59.165h-59.278v-59.165z' fill='' p-id='2592' />
65+
<div className='footer_link'>
66+
<h3 className='footer_link_tit footer_link_tit2'>社区</h3>
67+
<p>
68+
<a
69+
href='https://github.com/NervJS/taro/issues'
70+
target='_blank'
71+
rel='noopener noreferrer'
72+
>
73+
GitHub
74+
</a>
75+
</p>
76+
<p>
77+
<a
78+
href='https://taro-club.jd.com'
79+
target='_blank'
80+
rel='noopener noreferrer'
81+
>
82+
Taro BBS
83+
</a>
84+
</p>
85+
<p className='footer_link_connect_wrap'>
86+
<span className='footer_link_connect footer_link_wechat'>
87+
微信
88+
<span className='wechat_qrcode_icon'>
89+
<svg
90+
t='1554966525626'
91+
className='icon svgicon'
92+
viewBox='0 0 1024 1024'
93+
version='1.1'
94+
xmlns='http://www.w3.org/2000/svg'
95+
p-id='2588'
96+
data-spm-anchor-id='a313x.7781069.0.i0'
97+
>
98+
<path
99+
d='M240.071 241.095h59.278v59.278h-59.278v-59.278z'
100+
fill=''
101+
p-id='2589'
102+
/>
103+
<path
104+
d='M405.959 134.485h-272.611v272.611h106.723v47.445h59.278v-47.445h106.723v-59.278h47.445v-47.445h-47.445l-0.114-165.888zM346.795 347.819h-154.169v-154.055h154.055v154.055h0.114zM240.071 727.154h59.278v59.278h-59.278v-59.278zM726.016 241.095h59.278v59.278h-59.278v-59.278zM512.683 509.042v63.943h59.278v-59.165h47.445v-59.278h-47.445v-47.445h-59.278v101.945zM512.683 725.789v60.643h59.278v-106.723h47.445v-59.278h-106.723v105.358zM571.961 786.432h47.445v47.445h-47.445v-47.445zM453.405 833.877v59.165h118.557v-59.165h-118.557z'
105+
fill=''
106+
p-id='2590'
107+
/>
108+
<path
109+
d='M678.685 679.709h-59.278v106.723h106.61v-59.278h-47.331v-47.445zM726.016 893.042h166.002v-59.165h-106.723v-47.445h-59.278v106.61zM892.018 513.821v-59.278h-106.723v59.278h106.723zM832.739 727.154h59.278v59.278h-59.278v-59.278zM453.405 347.819h59.278v59.278h-59.278v-59.278zM726.016 454.542v-47.445h166.002v-272.611h-272.611v59.278h-106.723v47.445h106.723v59.165h-47.445v47.445h47.445v59.278h59.278v47.445h47.331zM678.685 193.763h154.055v154.055h-154.055v-154.055zM678.685 572.985h47.331v47.445h-47.331v-47.445zM785.294 679.709h-59.278v47.445h106.723v-106.723h59.278v-47.445h-106.723v106.723zM453.405 241.095h59.278v59.278h-59.278v-59.278zM299.349 513.821h47.445v59.165h-47.445v-59.165zM453.405 454.542h-106.61v59.278h59.165v59.165h47.445v-118.443z'
110+
fill=''
111+
p-id='2591'
112+
/>
113+
<path
114+
d='M405.959 786.432v-106.723h47.445v-59.278h-213.333v-106.61h-106.723v59.278h59.278v47.445h-59.278v272.611h272.611v-59.278h47.445v-47.445h-47.445zM346.795 833.877h-154.169v-154.169h154.055v154.169h0.114zM453.405 572.985h59.278v47.445h-59.278v-47.445zM619.406 513.821h59.278v59.165h-59.278v-59.165zM726.016 513.821h59.278v59.165h-59.278v-59.165z'
115+
fill=''
116+
p-id='2592'
117+
/>
32118
</svg>
33-
</span></span>
34-
<span className='footer_link_wechat_img'>
35-
<img src='https://camo.githubusercontent.com/10834a234b99a5880b5dff7c0ca7235e2a0772e7/687474703a2f2f696d6732302e333630627579696d672e636f6d2f7562612f6a66732f7432303139372f3238332f313638373136383837342f3133363034322f32623464383131662f35623330613635634e39643166303366312e706e67' />
36119
</span>
37-
</p>
38-
</div>
39-
<div className='footer_link'>
40-
<h3 className='footer_link_tit footer_link_tit3'>关于我们</h3>
41-
<p><a href='https://aotu.io/' target='_blank'>凹凸实验室</a></p>
42-
<p><a href='https://aotu.io/join/' target='_blank'>加入我们</a></p>
43-
<p><a href='mailto:[email protected]?subject=【Taro 合作】合作标题'>联系我们</a></p>
44-
</div>
45-
<div className='footer_link'>
46-
<h3 className='footer_link_tit footer_link_tit4'>感谢</h3>
47-
<p><a href='http://jdc.jd.com/' target='_blank'>用户体验设计部</a></p>
48-
<p><a href='https://github.com/nervjs/taro#%E8%B4%A1%E7%8C%AE%E8%80%85%E4%BB%AC' target='_blank'>Taro 贡献者们</a></p>
49-
</div>
120+
</span>
121+
<span className='footer_link_wechat_img'>
122+
<img src='https://camo.githubusercontent.com/10834a234b99a5880b5dff7c0ca7235e2a0772e7/687474703a2f2f696d6732302e333630627579696d672e636f6d2f7562612f6a66732f7432303139372f3238332f313638373136383837342f3133363034322f32623464383131662f35623330613635634e39643166303366312e706e67' />
123+
</span>
124+
</p>
125+
</div>
126+
<div className='footer_link'>
127+
<h3 className='footer_link_tit footer_link_tit3'>关于我们</h3>
128+
<p>
129+
<a
130+
href='https://aotu.io/'
131+
target='_blank'
132+
rel='noopener noreferrer'
133+
>
134+
凹凸实验室
135+
</a>
136+
</p>
137+
<p>
138+
<a
139+
href='https://aotu.io/join/'
140+
target='_blank'
141+
rel='noopener noreferrer'
142+
>
143+
加入我们
144+
</a>
145+
</p>
146+
<p>
147+
<a href='mailto:[email protected]?subject=【Taro 合作】合作标题'>
148+
联系我们
149+
</a>
150+
</p>
151+
</div>
152+
<div className='footer_link'>
153+
<h3 className='footer_link_tit footer_link_tit4'>感谢</h3>
154+
<p>
155+
<a
156+
href='http://jdc.jd.com/'
157+
target='_blank'
158+
rel='noopener noreferrer'
159+
>
160+
用户体验设计部
161+
</a>
162+
</p>
163+
<p>
164+
<a
165+
href='https://github.com/nervjs/taro#%E8%B4%A1%E7%8C%AE%E8%80%85%E4%BB%AC'
166+
target='_blank'
167+
rel='noopener noreferrer'
168+
>
169+
Taro 贡献者们
170+
</a>
171+
</p>
50172
</div>
51173
</div>
52-
<div className='copyright'>
53-
<div className='in'>Copyright © 2019. All Rights Reserved. 粤ICP备15077732号-2</div>
174+
</div>
175+
<div className='copyright'>
176+
<div className='in'>
177+
Copyright © 2019. All Rights Reserved. 粤ICP备15077732号-2
54178
</div>
55-
</footer>
56-
)
57-
}
179+
</div>
180+
</footer>
181+
)
58182

59183
export default Footer

packages/taro-ui-docs/components/header/index.jsx

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
import * as Nerv from 'nervjs'
1+
import React from 'react'
22
import classnames from 'classnames'
33
import { Link, NavLink, withRouter } from 'react-router-dom'
44
import taroUILogo from '../../assets/logo-taro.png'
55
import './style.scss'
66

7-
class PageHeader extends Nerv.Component {
8-
constructor (...args) {
7+
class PageHeader extends React.Component {
8+
constructor(...args) {
99
super(...args)
1010
this.state = {
1111
toggle: true
1212
}
1313
}
14-
toggleMenu = () => {
14+
toggleMenu() {
1515
const _toggle = this.state.toggle
1616
this.setState({
1717
toggle: !_toggle
1818
})
1919
}
20-
goToGuide (e) {
20+
goToGuide(e) {
2121
e.preventDefault()
2222
}
23-
goToSource (e) {
23+
goToSource(e) {
2424
e.preventDefault()
2525
}
2626

27-
render () {
27+
render() {
2828
const { collapse, style } = this.props
2929
const { toggle } = this.state
3030
return (
@@ -49,16 +49,33 @@ class PageHeader extends Nerv.Component {
4949
>
5050
<ul className='navbar'>
5151
<li>
52-
<NavLink activeClassName='router-link-active' to='/docs/introduction'>组件</NavLink>
52+
<NavLink
53+
activeClassName='router-link-active'
54+
to='/docs/introduction'
55+
>
56+
组件
57+
</NavLink>
5358
</li>
5459
<li>
55-
<NavLink activeClassName='router-link-active' to='/docs/resource'>设计资源</NavLink>
60+
<NavLink
61+
activeClassName='router-link-active'
62+
to='/docs/resource'
63+
>
64+
设计资源
65+
</NavLink>
5666
</li>
5767
<li>
58-
<a href='https://nervjs.github.io/taro-ui-theme-preview/' target='__blank'>主题生成器</a>
68+
<a
69+
href='https://nervjs.github.io/taro-ui-theme-preview/'
70+
target='__blank'
71+
>
72+
主题生成器
73+
</a>
5974
</li>
6075
<li>
61-
<a href='https://aotu.io/' target='__blank'>关于我们</a>
76+
<a href='https://aotu.io/' target='__blank'>
77+
关于我们
78+
</a>
6279
</li>
6380
</ul>
6481
</div>

packages/taro-ui-docs/components/iconlist/index.jsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
import * as Nerv from 'nervjs'
2-
1+
import React from 'react'
32
import ICONS from './icons.js'
43
import './style.scss'
54

6-
class IconList extends Nerv.Component {
7-
render () {
5+
class IconList extends React.Component {
6+
render() {
87
const { type = 'main' } = this.props
98
const iconlist = ICONS[type]
109

1110
return (
12-
<ul class="at-iconlist row">
11+
<ul className='at-iconlist row'>
1312
{iconlist.map((icon, index) => (
14-
<li class="at-iconlist__item col-sm-6 col-md-4 col-lg-3 flex flex-middle flex-center">
15-
<div class="">
16-
<i class={`at-icon at-icon-${icon}`}></i>
13+
<li
14+
className='at-iconlist__item col-sm-6 col-md-4 col-lg-3 flex flex-middle flex-center'
15+
key={`icon-list-${index}`}
16+
>
17+
<div className=''>
18+
<i className={`at-icon at-icon-${icon}`}></i>
1719
<p>{icon}</p>
1820
</div>
1921
</li>

0 commit comments

Comments
 (0)