-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.tsx
143 lines (139 loc) · 2.95 KB
/
example.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import React from "react";
import ReactDOM from "react-dom";
import { HashRouter as Router, Route, Link, NavLink } from "react-router-dom";
import Layout, { Header, Aside, Content, Footer } from "./lib/layout/layout";
import * as Doc from "./lib/doc/index";
import * as Example from "./lib/example/index";
import { Icon } from "./lib";
import "./example.scss";
const PAGES = [
// {
// key: "home",
// name: "首页",
// component: HomeView,
// },
{
key: "intro",
name: "介绍",
component: Doc.Intro,
},
{
key: "install",
name: "安装",
component: Doc.Install,
},
{
key: "start",
name: "开始使用",
component: Doc.Start,
}
]
const ROUTERS = [
{
key: "icon",
name: "Icon 图标",
component: Example.Icon,
},
{
key: "layout",
name: "Layout 布局",
component: Example.Layout,
},
{
key: "button",
name: "Button 按钮",
component: Example.Button,
},
{
key: "dialog",
name: "Dialog 对话框",
component: Example.Dialog,
},
];
ReactDOM.render(
<Router>
<Layout className="examples-doc">
<Header className="header">
<Link className="logo" to="/intro" >
<img src={require("./logo.png")} alt="s1mple-react" />
</Link>
<div className="header-container">
<ul className="sub-menu row">
{PAGES.map(page => (
<li key={page.key} className="menu-item">
<NavLink to={`/${page.key}`}>
{page.name}
</NavLink>
</li>
))}
</ul>
<nav
className="icon-container"
onClick={e =>
window.open("https://github.com/chenxingyu0830")
}
>
<Icon name="github" />
<span>github</span>
</nav>
</div>
</Header>
<Layout className="body">
<Aside className="aside">
<p className="menu-title">文档</p>
<ul className="sub-menu">
{PAGES.map(page => (
<li key={page.key} className="menu-item">
<NavLink to={`/${page.key}`}>
{page.name}
</NavLink>
</li>
))}
</ul>
<p className="menu-title">组件</p>
<ul className="sub-menu">
{ROUTERS.map(router => (
<li key={router.key} className="menu-item">
<NavLink to={`/${router.key}`}>
{router.name}
</NavLink>
</li>
))}
</ul>
</Aside>
<Content>
{PAGES.concat(ROUTERS).map(router => (
<Route
key={router.key}
path={`/${router.key}`}
component={router.component}
/>
))}
</Content>
</Layout>
<Footer className="footer">
<nav
className="icon-container"
onClick={e =>
window.open("https://github.com/chenxingyu0830")
}
>
<Icon name="github" />
<span>github</span>
</nav>
<nav
className="icon-container"
onClick={e =>
window.open(
"https://github.com/chenxingyu0830/s1mple-react"
)
}
>
<Icon name="react" />
<span>项目地址</span>
</nav>
</Footer>
</Layout>
</Router>,
document.querySelector("#root")
);