Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
minwe committed Oct 28, 2015
0 parents commit 0a4e267
Show file tree
Hide file tree
Showing 25 changed files with 786 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
45 changes: 45 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"extends": "airbnb",
"rules": {
/* JSX */
"react/prop-types": [1, {
"ignore": ["className", "children"]
}],
"react/sort-comp": [ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
2,
{
"order": [
"lifecycle",
"/^on.+$/",
"/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/",
"everything-else",
"/^render.+$/",
"render"
],
"groups": {
"lifecycle": [
"displayName",
"mixins",
"propTypes",
"contextTypes",
"childContextTypes",
"statics",
"defaultProps",
"constructor",
"getDefaultProps",
"getInitialState",
"state",
"getChildContext",
"componentWillMount",
"componentDidMount",
"componentWillReceiveProps",
"shouldComponentUpdate",
"componentWillUpdate",
"componentDidUpdate",
"componentWillUnmount"
]
}
}
]
}
}
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Editor
.idea

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

dist
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2015 Amaze UI

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Amaze UI Touch Starter Kit

Amaze UI Touch 快速上手套件,基于 React、Amaze UI Touch、React Router 及 Gulp 开发 SPA。

**套件中目前只包含客户部代码,亦未包含 Flux、Redux 等框架**

## 目录结构

项目文件放在 `app` 目录下:

```
.app
├── humans.txt
├── i // 图片
├── index.html // 入口 HTML
├── js // JS
├── style // 样式文件(编译任务中设置的是 Sass,可以自行改用其他)
├── manifest.json
├── manifest.webapp
└── robots.txt
```

## 使用说明

### 环境配置

- 安装 [Node.js](https://nodejs.org/en/download/)
- 模块编译环境配置:[点击查看](https://github.com/nodejs/node-gyp#installation)

### 全局安装 gulp:

```
npm install gulp -g
```

### 安装开发依赖

1. 克隆或下载本项目代码;
2. 进入项目目录,执行 `npm install`

### 开发

```
gulp
```

或者

```
npm start
```

### 生产环境构建

设置 Node 环境变量为 `production` 后,HTML 中引用的 CSS 和 JS 会替换为 minify 的版本。

```
NODE_ENV=production gulp build
```

**[fish](http://fishshell.com/)**:

```
env NODE_ENV=production gulp build
```
14 changes: 14 additions & 0 deletions app/humans.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# humanstxt.org/
# The humans responsible & technology colophon

# TEAM

<name> -- <role> -- <twitter>

# THANKS

<name>

# TECHNOLOGY COLOPHON

HTML5, CSS3
Binary file added app/i/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/i/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/i/touch/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/i/touch/chrome-touch-icon-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/i/touch/icon-128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!doctype html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description"
content="An Amaze UI Touch template that helps you build fast, modern mobile web apps.">
<meta name="viewport"
content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<title>Amaze UI Touch Starter Kit</title>

<!-- Set render engine for 360 browser -->
<meta name="renderer" content="webkit">

<!-- No Baidu Siteapp-->
<meta http-equiv="Cache-Control" content="no-siteapp"/>

<link rel="icon" type="image/png" href="i/favicon.png">

<!-- Add to homescreen -->
<link rel="manifest" href="manifest.json">

<!-- Fallback to homescreen for Chrome <39 on Android -->
<meta name="mobile-web-app-capable" content="yes">
<meta name="application-name" content="Web Starter Kit">
<link rel="icon" sizes="192x192" href="i/touch/chrome-touch-icon-192x192.png">

<!-- Add to homescreen for Safari on iOS -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title"
content="Amaze UI Starter Kit">
<link rel="apple-touch-icon" href="i/touch/apple-touch-icon.png">

<!-- Tile icon for Win8 (144x144 + tile color) -->
<meta name="msapplication-TileImage"
content="i/touch/ms-touch-icon-144x144-precomposed.png">
<meta name="msapplication-TileColor" content="#0e90d2">

<!-- SEO: If your mobile URL is different from the desktop URL, add a canonical link to the desktop page https://developers.google.com/webmasters/smartphone-sites/feature-phones -->
<!--
<link rel="canonical" href="http://www.example.com/">
-->
<link rel="stylesheet" href="css/amazeui.touch.min.css"/>
<link rel="stylesheet" href="css/app{{__VERSION__}}.css">
<script src="js/app{{__VERSION__}}.js"></script>
</head>
<body>
<div class="root" id="root">
</div>
</body>
</html>
73 changes: 73 additions & 0 deletions app/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import React from 'react';
import {
render,
} from 'react-dom';
import {
Router,
Route,
Link,
IndexRoute,
} from 'react-router';
import {
Container,
TabBar,
} from 'amazeui-touch';

const App = React.createClass({
render() {
const {
location,
params,
children,
...props,
} = this.props;
const transition = children.props.transition || 'sfr';

return (
<Container direction="column" id="sk-container">
<Container
transition={transition}
>
{React.cloneElement(children, {key: location.key})}
</Container>

<TabBar
amStyle="primary"
>
<TabBar.Item
component={Link}
icon="list"
title="组件"
selected={!params.page}
to="/"
/>
<TabBar.Item
component={Link}
icon="info"
title="关于"
badge="404"
selected={params.page === 'about'}
to="/about"
/>
</TabBar>
</Container>
);
},
});

// Pages
import Index from './pages/Index';
import Page from './pages/Page';

const routes = (
<Router>
<Route path="/" component={App}>
<IndexRoute component={Index} />
<Route path=":page" component={Page} />
</Route>
</Router>
);

document.addEventListener('DOMContentLoaded', () => {
render(routes, document.getElementById('root'));
});
60 changes: 60 additions & 0 deletions app/js/pages/Index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import React from 'react';
import {
Container,
List,
NavBar,
Group,
View,
} from 'amazeui-touch';
import {
Link,
} from 'react-router';

const Index = React.createClass({
getDefaultProps() {
return {
transition: 'rfr',
};
},

renderItems() {
const pages = [
'Page1',
'Page2',
];

return pages.map((item, index) => {
return (
<List.Item
linkComponent={Link}
linkProps={{to: `/${item.toLowerCase()}`}}
title={item}
key={index}
/>
);
});
},

render() {
return (
<View>
<NavBar
amStyle="primary"
title="AMT Starter Kit"
/>
<Container scrollable>
<Group
header="Welcome to AMT."
noPadded
>
<List>
{this.renderItems()}
</List>
</Group>
</Container>
</View>
);
},
});

export default Index;
Loading

0 comments on commit 0a4e267

Please sign in to comment.