Skip to content

Commit

Permalink
v1.0.0.: webpack used for examples, dependencies reorganized, example…
Browse files Browse the repository at this point in the history
… code highlighting fix, updated README, hosting example on gh-pages.
  • Loading branch information
fortunar committed Sep 15, 2018
1 parent 8ad4e3d commit 3930ff9
Show file tree
Hide file tree
Showing 44 changed files with 6,353 additions and 135,597 deletions.
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["env", "react", "es2015"],
"plugins": ["transform-object-rest-spread"]
}
39 changes: 0 additions & 39 deletions .eslintrc.json

This file was deleted.

Binary file modified .gitignore
Binary file not shown.
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
src
examples
.babelrc
.gitignore
webpack.config.js
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@


# react-sidemenu

Lightweight side menu component written in React.js. No jQuery, just CSS3.
Expand All @@ -24,9 +25,10 @@ ES6 syntax:
ES5 syntax:

var SideMenu = require('react-sidemenu').SideMenu;
**Styling:** To use default styling include `react-sidemenu.css` to your project. For an idea on how to customize styling see [Demo](http://react-sidemenu-demo.herokuapp.com/).
## Styling!
To use default styling include `side-menu.css` to your project. You can find it in dist folder when installing via `npm`. For an idea on how to customize styling see [Demo](https://fortunar.github.io/react-sidemenu/).
## Demo & Examples
[Demo](http://react-sidemenu-demo.herokuapp.com/) showcasing the functionalities & code examples (wait for it to load a bit as it is on free plan on Heroku). We use Font Awesome as a CDN for the example icons to show.
[Demo](https://fortunar.github.io/react-sidemenu/) showcasing the functionalities & code examples. We use Font Awesome as a CDN for the example icons to show.

You can run examples by yourself. Clone the repo and do:

Expand All @@ -35,7 +37,7 @@ You can run examples by yourself. Clone the repo and do:

## Options

< SideMenu > - main component
`<SideMenu>` - main component

|**Option**|**Default**|**Description**|
| --- | --- | --- |
Expand All @@ -48,7 +50,7 @@ You can run examples by yourself. Clone the repo and do:
| rtl | false | This property enables you to use the sidemenu in a right-to-left page. [Example](http://react-sidemenu-demo.herokuapp.com/) |
| shouldTriggerClickOnParents | false | This property enables triggering 'onMenuItemClick' on parent items that have children. |

< Item > - this component is for the non-JSON config of the menu
`<Item>` - this component is for the non-JSON config of the menu

|**Option**|**Description**|
| --- | --- |
Expand All @@ -63,5 +65,5 @@ You can run examples by yourself. Clone the repo and do:
Any contribution is welcome.

To be done:

- tests & CI support
- refactor examples code (it's awful, I know)
Empty file removed bower.json
Empty file.
1 change: 0 additions & 1 deletion example/src/app.less → demo/app.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "../../less/side-menu.less";

@color-white: #F2F2F2;
body {
Expand Down
28 changes: 12 additions & 16 deletions example/src/example-active-item.js → demo/example-active-item.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import React from 'react';
import {SideMenu, Item} from 'react-sidemenu';
import ReactDOM from 'react-dom';
import createReactClass from 'create-react-class';
import React, {Component} from 'react';
import SideMenu, {Item} from 'src';

let ExampleActiveItem = createReactClass({
export default class ExampleActiveItem extends Component {
constructor(props) {
super(props);
this.state = {activeItem : 'item1.1.1'};
}

getInitialState: function() {
return { activeItem: 'item1.1.1'};
},

render: function() {
return (
render() {
return (
<div>
<p>
<b>activeItem</b> propery presets the active menu item and opens all the necessary parents.
Expand Down Expand Up @@ -41,8 +39,6 @@ let ExampleActiveItem = createReactClass({
<Item label="Item 3" value="item3" icon="fa-beer"/>
</SideMenu>
</div>
)
}
});

ReactDOM.render(<ExampleActiveItem />, document.getElementById('example-active-item'));
);
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import React from 'react';
import {SideMenu, Item} from 'react-sidemenu';
import ReactDOM from 'react-dom';
import createReactClass from 'create-react-class';
import React, {Component} from 'react';
import SideMenu, {Item} from 'src';

let Example4 = createReactClass({
render: function() {
export default class ExampleCustomClick extends Component {
render() {
return (
<div>
<p>
Expand All @@ -30,8 +28,6 @@ let Example4 = createReactClass({
<Item label="Item 3" value="item3" icon="fa-beer"/>
</SideMenu>
</div>
)
);
}
});

ReactDOM.render(<Example4 />, document.getElementById('example-custom-click'));
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import React from 'react';
import {SideMenu, Item} from 'react-sidemenu';
import ReactDOM from 'react-dom';
import createReactClass from 'create-react-class';
import React, {Component} from 'react';
import SideMenu, {Item} from 'src';

let Example3 = createReactClass({
render: function() {
export default class ExampleCustomRender extends Component {
render() {
return (
<div>
<p>
Expand All @@ -30,8 +28,6 @@ let Example3 = createReactClass({
<Item label="Item 3" value="item3" icon="fa-beer"/>
</SideMenu>
</div>
)
);
}
});

ReactDOM.render(<Example3 />, document.getElementById('example-custom-render'));
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import React from 'react';
import {SideMenu, Item} from 'react-sidemenu';
import ReactDOM from 'react-dom';
import createReactClass from 'create-react-class';
import React, {Component} from 'react';
import SideMenu, {Item} from 'src';

let ExampleTheme = createReactClass({
render: function() {
export default class ExampleCustomTheme extends Component {
render() {
return (
<div>
<p>
Expand All @@ -30,8 +28,6 @@ let ExampleTheme = createReactClass({
<Item label="Item 3" value="item3" icon="fa-beer"/>
</SideMenu>
</div>
)
);
}
});

ReactDOM.render(<ExampleTheme />, document.getElementById('example-custom-theme'));
}
19 changes: 7 additions & 12 deletions example/src/example-no-collapse.js → demo/example-no-collapse.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import React from 'react';
import {SideMenu, Item} from 'react-sidemenu';
import ReactDOM from 'react-dom';
import createReactClass from 'create-react-class';
import React, {Component} from 'react';
import SideMenu, {Item} from 'src';

let Example2 = createReactClass({
render: function() {
return (
<div>
export default class ExampleNoCollapse extends Component {
render() {
return(<div>
<p>
This propery controls whether sections of menu collapse when you click on other items.
</p>
Expand All @@ -30,8 +27,6 @@ let Example2 = createReactClass({
<Item label="Item 3" value="item3" icon="fa-beer"/>
</SideMenu>
</div>
)
);
}
});

ReactDOM.render(<Example2 />, document.getElementById('example-no-collapse'));
}
16 changes: 6 additions & 10 deletions example/src/example-normal.js → demo/example-normal.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';
import {SideMenu} from 'react-sidemenu';
import ReactDOM from 'react-dom';
import createReactClass from 'create-react-class';
import React, {Component} from 'react';
import SideMenu from 'src';

const items = [
{divider: true, label: 'Segment 1', value: 'segment1'},
Expand All @@ -23,17 +21,15 @@ const items = [
{label: 'Item 3', value: 'item3', icon: 'fa-beer'}
];

let Example1 = createReactClass({
render: function() {
export default class ExampleNormal extends Component {
render() {
return (
<div>
<SideMenu
items={items}
reverse={false}
/>
</div>
)
);
}
});

ReactDOM.render(<Example1 />, document.getElementById('example-normal'));
}
16 changes: 6 additions & 10 deletions example/src/example-rtl.js → demo/example-rtl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';
import {SideMenu} from 'react-sidemenu';
import ReactDOM from 'react-dom';
import createReactClass from 'create-react-class';
import React, {Component} from 'react';
import SideMenu from 'src';

const items = [
{divider: true, label: 'Segment 1', value: 'segment1'},
Expand All @@ -23,17 +21,15 @@ const items = [
{label: 'Item 3', value: 'item3', icon: 'fa-beer'}
];

let Example5 = createReactClass({
render: function() {
export default class ExampleRTL extends Component {
render() {
return (
<div>
<SideMenu
items={items}
rtl={true}
/>
</div>
)
);
}
});

ReactDOM.render(<Example5 />, document.getElementById('example-rtl'));
}
Loading

0 comments on commit 3930ff9

Please sign in to comment.