Skip to content

Commit a8eeed8

Browse files
committed
add tabs and serachbar withou doc and test
1 parent 6b19cfe commit a8eeed8

19 files changed

+10596
-1
lines changed

Diff for: example/app.js

+9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ import Article from './pages/article/index';
2222
import ActionSheet from './pages/actionsheet/index';
2323
import Icons from './pages/icons/index';
2424
import Panel from './pages/panel/index';
25+
import Tab from './pages/tab/index';
26+
import NavBar from './pages/tab/navbar';
27+
import TabBar from './pages/tab/tabbar';
28+
import SearchBar from './pages/searchbar/index';
2529

2630
class App extends React.Component {
2731
render() {
@@ -31,6 +35,7 @@ class App extends React.Component {
3135
transitionName="page"
3236
transitionEnterTimeout={500}
3337
transitionLeaveTimeout={500}
38+
style={{height: '100%'}}
3439
>
3540
{React.cloneElement(this.props.children, {
3641
key: this.props.location.pathname
@@ -54,6 +59,10 @@ ReactDOM.render((
5459
<Route path="actionsheet" component={ActionSheet}/>
5560
<Route path="icons" component={Icons}/>
5661
<Route path="panel" component={Panel}/>
62+
<Route path="tab" component={Tab}/>
63+
<Route path="navbar" component={NavBar}/>
64+
<Route path="tabbar" component={TabBar}/>
65+
<Route path="searchbar" component={SearchBar}/>
5766
</Route>
5867
</Router>
5968
), document.getElementById('container'));

Diff for: example/pages/home/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ export default class Home extends React.Component {
6565
icon: <img src={IconPanel}/>,
6666
label: 'Panel',
6767
href: '#panel'
68+
}, {
69+
icon: <img src={IconTab}/>,
70+
label: 'Tab',
71+
href: '#tab'
72+
}, {
73+
icon: <img src={IconSearchBar}/>,
74+
label: 'SearchBar',
75+
href: '#searchbar'
6876
}]
6977
};
7078

Diff for: example/pages/searchbar/index.js

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/**
2+
* Created by n7best.
3+
*/
4+
5+
"use strict";
6+
7+
import React from 'react';
8+
import Page from '../../component/page';
9+
import SampleData from './nameDB';
10+
11+
import {
12+
//main component
13+
SearchBar,
14+
//for display data
15+
Panel,
16+
PanelHeader,
17+
PanelBody,
18+
PanelFooter,
19+
MediaBox,
20+
MediaBoxHeader,
21+
MediaBoxBody,
22+
MediaBoxTitle,
23+
MediaBoxDescription,
24+
MediaBoxInfo,
25+
MediaBoxInfoMeta,
26+
Cells,
27+
Cell,
28+
CellHeader,
29+
CellBody,
30+
CellFooter
31+
} from '../../../src/index';
32+
33+
const appMsgIcon = <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAMAAAAOusbgAAAAeFBMVEUAwAD///+U5ZTc9twOww7G8MYwzDCH4YcfyR9x23Hw+/DY9dhm2WZG0kbT9NP0/PTL8sux7LFe115T1VM+zz7i+OIXxhes6qxr2mvA8MCe6J6M4oz6/frr+us5zjn2/fa67rqB4IF13XWn6ad83nxa1loqyirn+eccHxx4AAAC/klEQVRo3u2W2ZKiQBBF8wpCNSCyLwri7v//4bRIFVXoTBBB+DAReV5sG6lTXDITiGEYhmEYhmEYhmEYhmEY5v9i5fsZGRx9PyGDne8f6K9cfd+mKXe1yNG/0CcqYE86AkBMBh66f20deBc7wA/1WFiTwvSEpBMA2JJOBsSLxe/4QEEaJRrASP8EVF8Q74GbmevKg0saa0B8QbwBdjRyADYxIhqxAZ++IKYtciPXLQVG+imw+oo4Bu56rjEJ4GYsvPmKOAB+xlz7L5aevqUXuePWVhvWJ4eWiwUQ67mK51qPj4dFDMlRLBZTqF3SDvmr4BwtkECu5gHWPkmDfQh02WLxXuvbvC8ku8F57GsI5e0CmUwLz1kq3kD17R1In5816rGvQ5VMk5FEtIiWislTffuDpl/k/PzscdQsv8r9qWq4LRWX6tQYtTxvI3XyrwdyQxChXioOngH3dLgOFjk0all56XRi/wDFQrGQU3Os5t0wJu1GNtNKHdPqYaGYQuRDfbfDf26AGLYSyGS3ZAK4S8XuoAlxGSdYMKwqZKM9XJMtyqXi7HX/CiAZS6d8bSVUz5J36mEMFDTlAFQzxOT1dzLRljjB6+++ejFqka+mXIe6F59mw22OuOw1F4T6lg/9VjL1rLDoI9Xzl1MSYDNHnPQnt3D1EE7PrXjye/3pVpr1Z45hMUdcACc5NVQI0bOdS1WA0wuz73e7/5TNqBPhQXPEFGJNV2zNqWI7QKBd2Gn6AiBko02zuAOXeWIXjV0jNqdKegaE/kJQ6Bfs4aju04lMLkA2T5wBSYPKDGF3RKhFYEa6A1L1LG2yacmsaZ6YPOSAMKNsO+N5dNTfkc5Aqe26uxHpx7ZirvgCwJpWq/lmX1hA7LyabQ34tt5RiJKXSwQ+0KU0V5xg+hZrd4Bn1n4EID+WkQdgLfRNtvil9SPfwy+WQ7PFBWQz6dGWZBLkeJFXZGCfLUjCgGgqXo5TuSu3cugdcTv/HjqnBTEMwzAMwzAMwzAMwzAMw/zf/AFbXiOA6frlMAAAAABJRU5ErkJggg==" />
34+
35+
export default class SearchBarDemo extends React.Component {
36+
state={
37+
searchText: '',
38+
results: []
39+
};
40+
41+
handleChange(text){
42+
let keywords = [text];
43+
let results = SampleData.filter(/./.test.bind(new RegExp(keywords.join("|"),'i')));
44+
45+
if(results.length > 3) results = results.slice(0,3);
46+
this.setState({
47+
results,
48+
searchText:text,
49+
});
50+
}
51+
52+
render() {
53+
return (
54+
<Page className="searchbar" title="SearchBar">
55+
<SearchBar
56+
onChange={this.handleChange.bind(this)}
57+
/>
58+
59+
{/*display result*/}
60+
<Panel access style={{display: this.state.searchText ? null: 'none', marginTop: 0}}>
61+
<PanelHeader>
62+
英文名字
63+
</PanelHeader>
64+
<PanelBody>
65+
{
66+
this.state.results.length > 0 ?
67+
this.state.results.map((item,i)=>{
68+
return (
69+
<MediaBox key={i} type="appmsg" href="javascript:void(0);">
70+
<MediaBoxHeader>{appMsgIcon}</MediaBoxHeader>
71+
<MediaBoxBody>
72+
<MediaBoxTitle>{item}</MediaBoxTitle>
73+
<MediaBoxDescription>
74+
由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状,有自己的运行轨道。
75+
</MediaBoxDescription>
76+
</MediaBoxBody>
77+
</MediaBox>
78+
)
79+
})
80+
: <MediaBox>找不到了!</MediaBox>
81+
}
82+
</PanelBody>
83+
<PanelFooter href="javascript:void(0);">
84+
查看更多
85+
</PanelFooter>
86+
</Panel>
87+
</Page>
88+
);
89+
}
90+
};

0 commit comments

Comments
 (0)