Skip to content

Commit

Permalink
recommit
Browse files Browse the repository at this point in the history
  • Loading branch information
yiminghe committed Dec 25, 2014
1 parent 31c84a6 commit 529707f
Show file tree
Hide file tree
Showing 31 changed files with 1,485 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*.{js,css}]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
*.iml
*.log
.idea/
.ipr
.iws
*~
~*
*.diff
*.patch
*.bak
.DS_Store
Thumbs.db
.project
.*proj
.svn/
*.swp
*.swo
*.pyc
*.pyo
.build
node_modules
_site
sea-modules
spm_modules
.cache
dist
assets/**/*.css
27 changes: 27 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideObjectBrackets": true,
"disallowSpacesInsideParentheses": true,
"disallowQuotedKeysInObjects": "allButReserved",
"disallowSpaceAfterObjectKeys": true,
"requireSpaceBeforeBinaryOperators": ["-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<=" ],
"requireSpacesInConditionalExpression": {
"afterTest": true,
"beforeConsequent": true,
"afterConsequent": true,
"beforeAlternate": true
},
"requireSpaceAfterBinaryOperators": ["/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"disallowKeywords": [ "with" ],
"disallowSpaceAfterPrefixUnaryOperators": [ "!" , "++", "--", "+", "-", "~"],
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--", ","],
"disallowMultipleLineBreaks": true,
"disallowKeywordsOnNewLine": ["else"],
"safeContextKeyword": "self",
"excludeFiles": ["lib/**/parser.js"]
}
28 changes: 28 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"camelcase": true,
"curly": true,
"eqeqeq": true,
"freeze": true,
"indent": 4,
"latedef": "nofunc",
"quotmark": "false",
"nonew": true,
"newcap": false,
"immed": true,
"noarg": true,
"eqnull": true,
"trailing": true,
"undef": true,
"unused": true,
"browser": true,
"node": true,
"esnext": true,
"globals": {
"describe": false,
"expect": false,
"beforeEach": false,
"afterEach": false,
"modulex": false,
"it": false
}
}
28 changes: 28 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
bower_components/
*.cfg
node_modules/
nohup.out
*.iml
.idea/
.ipr
.iws
*~
~*
*.diff
*.log
*.patch
*.bak
.DS_Store
Thumbs.db
.project
.*proj
.svn/
*.swp
out/
.build
node_modules
_site
sea-modules
spm_modules
.cache
dist
29 changes: 29 additions & 0 deletions .spmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
bower_components/
node_modules/
nohup.out
*.iml
.idea/
.ipr
.iws
*~
~*
*.diff
*.log
*.patch
*.bak
.DS_Store
Thumbs.db
.project
.*proj
.svn/
*.swp
out/
.build
_site
sea-modules
spm_modules
.cache
dist
assets/**/*.less
tests/
examples/
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
language: node_js
notifications:
email:
- yiminghe@gmail.com
node_js:
- 0.11
before_script:
- npm start &
- npm install mocha-phantomjs -g
- phantomjs --version
script:
- npm test
- npm run-script browser-test
- npm run-script browser-test-cover
Empty file added HISTORY.md
Empty file.
83 changes: 80 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,81 @@
menu
====
# rc-menu

menu ui component for react
react menu component

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![gemnasium deps][gemnasium-image]][gemnasium-url]
[![node version][node-image]][node-url]
[![npm download][download-image]][download-url]

[npm-image]: http://img.shields.io/npm/v/rc-menu.svg?style=flat-square
[npm-url]: http://npmjs.org/package/rc-menu
[travis-image]: https://img.shields.io/travis/react-component/menu.svg?style=flat-square
[travis-url]: https://travis-ci.org/react-component/menu
[coveralls-image]: https://img.shields.io/coveralls/react-component/menu.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/react-component/menu?branch=master
[gemnasium-image]: http://img.shields.io/gemnasium/react-component/menu.svg?style=flat-square
[gemnasium-url]: https://gemnasium.com/react-component/menu
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
[node-url]: http://nodejs.org/download/
[download-image]: https://img.shields.io/npm/dm/rc-menu.svg?style=flat-square
[download-url]: https://npmjs.org/package/rc-menu


## examples
- [full](./examples/index.md)
- [pure css menu](./examples/pure-css.html)

![alt](https://tfsimg.alipay.com/images/T19vReXg0oXXXXXXXX.png)


## Usage
- It uses the [bootstrap](http://getbootstrap.com/)'s css and [Font Awesome](http://fortawesome.github.io/Font-Awesome/)

```js
var topMenu = (
<Menu className="navbar-nav" activeKey="1">

This comment has been minimized.

Copy link
@yiminghe

yiminghe Dec 25, 2014

Author Member

样式内置到组件,这个组件改成 Nav?

组件尽量不要留原生 dom 操作接口,比如搞成属性: bsStyle={bar:1}

<MenuItem eventKey="1" href="###" title="xx" onSelect={handleSelect} >xxx</MenuItem>
<MenuItem eventKey="2">Another action</MenuItem>

<Dropdown title={titleDown}>

<MenuItem eventKey="1">Action</MenuItem>
<MenuItem divider />
<MenuItem eventKey="2">Another action</MenuItem>

<Dropdown className="dropdown-submenu" title={titleRight}>
<MenuItem eventKey="2">Another action</MenuItem>
<MenuItem eventKey="3">Something else here</MenuItem>
</Dropdown>

</Dropdown>
</Menu>
);
React.render(topMenu, document.querySelector('#topMenu'));
```


## install

[![rc-menu](https://nodei.co/npm/rc-menu.png)](https://npmjs.org/package/rc-menu)

## Development

```
npm install
npm start
```

## Test Case

http://localhost:8000/tests/runner.html?coverage

## Coverage

http://localhost:8000/node_modules/rc-server/node_modules/node-jscover/lib/front-end/jscoverage.html?w=http://localhost:8000/tests/runner.html?coverage

## License

rc-menu is released under the MIT license.
26 changes: 26 additions & 0 deletions assets/dpl/dropdown-submenu.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* dropdown-submenu
*/
.dropdown-submenu {
position: relative;

>.dropdown-menu {
top: 0;
left: 100%;
}

&.pull-left{
float: none !important;
>.dropdown-menu {
left: -100%;
}
}
}

//override
.dropdown-submenu .fa{
line-height: 20px;
}
.dropdown-menu > li > a{
white-space: normal;
}
3 changes: 3 additions & 0 deletions assets/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

This comment has been minimized.

Copy link
@yiminghe

yiminghe Dec 25, 2014

Author Member

改成 bootstrap.less


@import "./dpl/dropdown-submenu";
23 changes: 23 additions & 0 deletions assets/pure-css.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**

This comment has been minimized.

Copy link
@yiminghe

yiminghe Dec 25, 2014

Author Member

删除组件无关的样式

* pure css menu
*/

@import "./dpl/dropdown-submenu";

// hover显示子菜单
.dropdown, .dropdown-submenu{
&:hover{
>.dropdown-menu,
>.dropdown-submenu {
display: block;
}
}
}

// hover改变背景色
.navbar-default, .navbar-inverse{
.navbar-nav > li > a:hover, .navbar-nav > li > a:focus{
background-color: #eee;
}
}

38 changes: 38 additions & 0 deletions examples/ind.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!doctype html>

This comment has been minimized.

Copy link
@yiminghe

yiminghe Dec 25, 2014

Author Member

删除 html demo

<html>
<head>
<title>rc-menu@1.0.0 demo</title>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.css" rel="stylesheet" />
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.css" rel="stylesheet" />
<link href="/assets/index.css" rel="stylesheet" />
</head>
<body>
<h1 style="text-align: center">rc-menu@1.0.0 demo</h1>
<div class="container">
<!-- top -->
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<a class="navbar-brand" href="#">project</a>
</div>
<div id="topMenu" class="collapse navbar-collapse"></div>
</nav>

<!-- left -->
<div class="col-sm-3 col-md-2"></div>

<!-- content -->
<div class="col-sm-6 col-md-8">
<b>this is full version and contains js.</b> <br />
</div>

<!-- right -->
<div class="col-sm-3 col-md-2"></div>

</div>

<script src="/node_modules/modulex/build/modulex-debug.js?nowrap"></script>
<script>
require('./index');
</script>
</body>
</html>
Loading

0 comments on commit 529707f

Please sign in to comment.