2015-08-22 03:34:12 +02:00
|
|
|
'use strict';
|
|
|
|
|
2016-06-12 02:37:08 +02:00
|
|
|
const React = require('react');
|
2016-10-14 02:42:37 +02:00
|
|
|
const _ = require('lodash');
|
2016-06-12 02:37:08 +02:00
|
|
|
const DocumentTitle = require('react-document-title');
|
2015-08-22 03:34:12 +02:00
|
|
|
|
2016-10-12 05:08:20 +02:00
|
|
|
const ModalContainer = require('app-components/modal-container');
|
2016-09-09 21:18:38 +02:00
|
|
|
const AreYouSure = require('app-components/are-you-sure');
|
|
|
|
|
2016-06-12 02:37:08 +02:00
|
|
|
const Button = require('core-components/button');
|
|
|
|
const Input = require('core-components/input');
|
|
|
|
const Checkbox = require('core-components/checkbox');
|
|
|
|
const Widget = require('core-components/widget');
|
|
|
|
const DropDown = require('core-components/drop-down');
|
|
|
|
const Menu = require('core-components/menu');
|
2016-08-31 06:50:41 +02:00
|
|
|
const Tooltip = require('core-components/tooltip');
|
2016-09-21 00:23:33 +02:00
|
|
|
const Table = require('core-components/table');
|
2015-10-18 00:13:18 +02:00
|
|
|
|
2016-01-26 14:40:35 +01:00
|
|
|
let dropDownItems = [{content: 'English'}, {content: 'Spanish'}, {content: 'German'}, {content: 'Portuguese'}, {content: 'Japanese'}];
|
2016-06-12 02:37:08 +02:00
|
|
|
let secondaryMenuItems = [
|
|
|
|
{content: 'My Tickets', icon: 'file-text'},
|
|
|
|
{content: 'New Ticket', icon: 'plus'},
|
|
|
|
{content: 'Articles', icon: 'book'},
|
|
|
|
{content: 'Edit Profile', icon: 'pencil'},
|
|
|
|
{content: 'Close Session', icon: 'lock'}
|
|
|
|
];
|
2015-08-22 03:34:12 +02:00
|
|
|
|
2016-01-26 14:40:35 +01:00
|
|
|
let DemoPage = React.createClass({
|
2015-08-22 03:34:12 +02:00
|
|
|
|
|
|
|
propTypes: {
|
|
|
|
currentUser: React.PropTypes.object.isRequired
|
|
|
|
},
|
|
|
|
|
|
|
|
elements: [
|
|
|
|
{
|
|
|
|
title: 'Primary Button',
|
|
|
|
render: (
|
|
|
|
<Button type="primary">Sign up</Button>
|
|
|
|
)
|
|
|
|
},
|
2015-09-24 02:33:25 +02:00
|
|
|
{
|
|
|
|
title: 'Input',
|
|
|
|
render: (
|
2016-07-02 00:27:20 +02:00
|
|
|
<Input placeholder="placeholder" error="No anda"/>
|
2015-09-24 02:33:25 +02:00
|
|
|
)
|
2015-10-15 01:05:21 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Input wrapped in a label',
|
|
|
|
render: (
|
2016-07-02 00:27:20 +02:00
|
|
|
<Input placeholder="placeholder" label="This is a label" icon="user"/>
|
2015-10-15 01:05:21 +02:00
|
|
|
)
|
|
|
|
},
|
2015-10-17 21:05:58 +02:00
|
|
|
{
|
|
|
|
title: 'Checkbox',
|
|
|
|
render: (
|
2016-09-21 00:23:33 +02:00
|
|
|
<Checkbox label="Remember me" value={true} />
|
2015-10-17 21:05:58 +02:00
|
|
|
)
|
|
|
|
},
|
2015-10-15 01:05:21 +02:00
|
|
|
{
|
|
|
|
title: 'Widget',
|
|
|
|
render: (
|
2015-10-18 00:13:18 +02:00
|
|
|
<Widget style={{ width: 324 }}>
|
2015-10-15 01:05:21 +02:00
|
|
|
<h2>Register here!</h2>
|
|
|
|
|
|
|
|
<Button type="primary">SIGN UP</Button>
|
|
|
|
</Widget>
|
|
|
|
)
|
2015-10-18 00:13:18 +02:00
|
|
|
},
|
2016-06-12 02:37:08 +02:00
|
|
|
{
|
|
|
|
title: 'Primary Menu',
|
|
|
|
render: (
|
|
|
|
<Menu items={dropDownItems} />
|
|
|
|
)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Secondary Menu',
|
|
|
|
render: (
|
|
|
|
<Menu items={secondaryMenuItems} type="secondary"/>
|
|
|
|
)
|
2016-08-31 06:50:41 +02:00
|
|
|
},
|
2016-09-25 02:33:09 +02:00
|
|
|
{
|
|
|
|
title: 'Navigation Menu',
|
|
|
|
render: (
|
|
|
|
<Menu items={secondaryMenuItems} type="navigation"/>
|
|
|
|
)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Horizontal Menu',
|
|
|
|
render: (
|
|
|
|
<Menu items={secondaryMenuItems.slice(0, 3)} type="horizontal"/>
|
|
|
|
)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'HorizontalList Menu',
|
|
|
|
render: (
|
|
|
|
<Menu items={dropDownItems.slice(0, 3)} type="horizontal-list"/>
|
|
|
|
)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'DropDown',
|
|
|
|
render: (
|
|
|
|
<DropDown items={dropDownItems} onChange={function (index) { console.log('changed to ' + index); }} />
|
|
|
|
)
|
|
|
|
},
|
2016-08-31 06:50:41 +02:00
|
|
|
{
|
|
|
|
title: 'Tooltip',
|
|
|
|
render: (
|
2016-09-09 21:18:38 +02:00
|
|
|
<div>
|
2016-09-24 02:42:31 +02:00
|
|
|
<Tooltip content="mensaje mensa jemensajemens ajem ensaje nsaje adicionals" openOnHover={true}>
|
|
|
|
hola
|
|
|
|
</Tooltip>
|
2016-09-09 21:18:38 +02:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'ModalTrigger',
|
|
|
|
render: (
|
|
|
|
<Button onClick={function () {
|
2016-09-09 23:22:17 +02:00
|
|
|
ModalContainer.openModal(
|
|
|
|
<AreYouSure description="I confirm I want to perform this action." onYes={()=> {alert('yes');}} />
|
2016-09-09 21:18:38 +02:00
|
|
|
);
|
|
|
|
}}>
|
|
|
|
Open Modal
|
|
|
|
</Button>
|
2016-08-31 06:50:41 +02:00
|
|
|
)
|
2016-09-21 00:23:33 +02:00
|
|
|
},
|
2016-10-14 02:42:37 +02:00
|
|
|
{
|
|
|
|
title: 'ModalTrigger Large',
|
|
|
|
render: (
|
|
|
|
<Button onClick={function () {
|
|
|
|
ModalContainer.openModal(
|
|
|
|
<div>
|
|
|
|
{_.range(1, 60).map(() => <div>Some modal content</div>)}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}}>
|
|
|
|
Open Large Modal
|
|
|
|
</Button>
|
|
|
|
)
|
|
|
|
},
|
2016-09-21 00:23:33 +02:00
|
|
|
{
|
|
|
|
title: 'Table',
|
|
|
|
render: (
|
|
|
|
<Table headers={[
|
|
|
|
{value:'Title First', key: 'title1'},
|
|
|
|
{value:'Title Second', key: 'title2'}
|
|
|
|
]} rows={[
|
2016-09-30 23:54:29 +02:00
|
|
|
{title1: 'Row1', title2: 'Example', n: 1},
|
|
|
|
{title1: 'Row2', title2: 'Example', n: 2},
|
|
|
|
{title1: 'Row3', title2: 'Example', n: 3},
|
|
|
|
{title1: 'Row4', title2: 'Example', n: 4},
|
|
|
|
{title1: 'Row5', title2: 'Example', n: 5},
|
|
|
|
{title1: 'Row6', title2: 'Example', n: 6},
|
|
|
|
{title1: 'Row7', title2: 'Example', n: 7},
|
|
|
|
{title1: 'Row8', title2: 'Example', n: 8},
|
|
|
|
{title1: 'Row9', title2: 'Example', n: 9},
|
|
|
|
{title1: 'Row10', title2: 'Example', n: 10},
|
|
|
|
{title1: 'Row11', title2: 'Example', n: 11},
|
|
|
|
{title1: 'Row12', title2: 'Example', n: 12},
|
|
|
|
{title1: 'Row13', title2: 'Example', n: 13},
|
|
|
|
{title1: 'Row14', title2: 'Example', n: 14}
|
|
|
|
]} pageSize={3} comp={function (a, b) {
|
|
|
|
let ans = 0;
|
|
|
|
if(a.title1 < b.title1)
|
|
|
|
ans = -1;
|
|
|
|
else if(a.title1 > b.title1)
|
|
|
|
ans = 1;
|
|
|
|
return ans;
|
|
|
|
}}/>
|
2016-09-21 00:23:33 +02:00
|
|
|
)
|
2015-09-24 02:33:25 +02:00
|
|
|
}
|
2015-08-22 03:34:12 +02:00
|
|
|
],
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<DocumentTitle title="Demo Page">
|
2016-06-12 02:37:08 +02:00
|
|
|
<section className="demo-page">
|
2015-08-22 03:34:12 +02:00
|
|
|
{this.renderElements()}
|
|
|
|
</section>
|
|
|
|
</DocumentTitle>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
renderElements: function () {
|
|
|
|
return this.elements.map((element) => {
|
|
|
|
return (
|
2016-09-21 00:23:33 +02:00
|
|
|
<div className="demo-element col-md-4">
|
2015-08-22 03:34:12 +02:00
|
|
|
<h4>
|
|
|
|
{element.title}
|
|
|
|
</h4>
|
|
|
|
<div class="demo-element--example">
|
|
|
|
{element.render}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default DemoPage;
|