mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-27 07:44:29 +02:00
[Ivan Diaz] - Add secondary menu, $secondary-blue variable, refactor Icon component, update demo page [skip ci]
This commit is contained in:
parent
6033e4afba
commit
f466a24b45
@ -1,16 +1,23 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
const React = require('react');
|
||||||
import {Link} from 'react-router';
|
const DocumentTitle = require('react-document-title');
|
||||||
import DocumentTitle from 'react-document-title';
|
|
||||||
|
|
||||||
import Button from 'core-components/button';
|
const Button = require('core-components/button');
|
||||||
import Input from 'core-components/input';
|
const Input = require('core-components/input');
|
||||||
import Checkbox from 'core-components/checkbox';
|
const Checkbox = require('core-components/checkbox');
|
||||||
import Widget from 'core-components/widget';
|
const Widget = require('core-components/widget');
|
||||||
import DropDown from 'core-components/drop-down';
|
const DropDown = require('core-components/drop-down');
|
||||||
|
const Menu = require('core-components/menu');
|
||||||
|
|
||||||
let dropDownItems = [{content: 'English'}, {content: 'Spanish'}, {content: 'German'}, {content: 'Portuguese'}, {content: 'Japanese'}];
|
let dropDownItems = [{content: 'English'}, {content: 'Spanish'}, {content: 'German'}, {content: 'Portuguese'}, {content: 'Japanese'}];
|
||||||
|
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'}
|
||||||
|
];
|
||||||
|
|
||||||
let DemoPage = React.createClass({
|
let DemoPage = React.createClass({
|
||||||
|
|
||||||
@ -58,13 +65,25 @@ let DemoPage = React.createClass({
|
|||||||
render: (
|
render: (
|
||||||
<DropDown items={dropDownItems} onChange={function (index) { console.log('changed to ' + index); }} />
|
<DropDown items={dropDownItems} onChange={function (index) { console.log('changed to ' + index); }} />
|
||||||
)
|
)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Primary Menu',
|
||||||
|
render: (
|
||||||
|
<Menu items={dropDownItems} />
|
||||||
|
)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Secondary Menu',
|
||||||
|
render: (
|
||||||
|
<Menu items={secondaryMenuItems} type="secondary"/>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<DocumentTitle title="Demo Page">
|
<DocumentTitle title="Demo Page">
|
||||||
<section className="home-page">
|
<section className="demo-page">
|
||||||
{this.renderElements()}
|
{this.renderElements()}
|
||||||
</section>
|
</section>
|
||||||
</DocumentTitle>
|
</DocumentTitle>
|
||||||
@ -74,7 +93,7 @@ let DemoPage = React.createClass({
|
|||||||
renderElements: function () {
|
renderElements: function () {
|
||||||
return this.elements.map((element) => {
|
return this.elements.map((element) => {
|
||||||
return (
|
return (
|
||||||
<div className="demo-element">
|
<div className="demo-element col-md-3">
|
||||||
<h4>
|
<h4>
|
||||||
{element.title}
|
{element.title}
|
||||||
</h4>
|
</h4>
|
||||||
|
@ -1,17 +1,45 @@
|
|||||||
import React from 'react';
|
const React = require('react');
|
||||||
|
const classNames = require('classnames');
|
||||||
|
|
||||||
let Icon = React.createClass({
|
const Icon = React.createClass({
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
name: React.PropTypes.string.isRequired
|
name: React.PropTypes.string.isRequired,
|
||||||
|
size: React.PropTypes.number
|
||||||
|
},
|
||||||
|
|
||||||
|
getDefaultProps() {
|
||||||
|
return {
|
||||||
|
size: 0
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (this.props.name.length > 2) ? this.renderFontIcon() : this.renderFlag();
|
||||||
<img className={this.props.className} src={`../images/icons/${this.props.name}.png`} />
|
},
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
renderFontIcon() {
|
||||||
|
return (
|
||||||
|
<span className={this.getFontIconClass()} aria-hidden="true" />
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
renderFlag() {
|
||||||
|
return (
|
||||||
|
<img className={this.props.className} src={`../images/icons/${this.props.name}.png`} aria-hidden="true" />
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
getFontIconClass() {
|
||||||
|
let classes = {
|
||||||
|
'fa': true,
|
||||||
|
['fa-' + this.props.name]: true,
|
||||||
|
['fa-' + this.props.size]: true,
|
||||||
|
[this.props.className]: true
|
||||||
|
};
|
||||||
|
|
||||||
|
return classNames(classes);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default Icon;
|
export default Icon;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
&--list-item {
|
&--list-item {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
@ -20,4 +21,10 @@
|
|||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&_secondary {
|
||||||
|
.menu--list-item:hover {
|
||||||
|
background-color: $secondary-blue;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -5,4 +5,4 @@
|
|||||||
@import 'scss/font_awesome/font-awesome';
|
@import 'scss/font_awesome/font-awesome';
|
||||||
|
|
||||||
@import 'core-components/*';
|
@import 'core-components/*';
|
||||||
@import 'app/main/*';
|
@import 'app/*';
|
||||||
|
@ -3,6 +3,7 @@ $primary-red: #DD5555;
|
|||||||
$secondary-red: #FB6362;
|
$secondary-red: #FB6362;
|
||||||
|
|
||||||
$primary-blue: #414A59;
|
$primary-blue: #414A59;
|
||||||
|
$secondary-blue: #20B8c5;
|
||||||
|
|
||||||
$light-grey: #EEEEEE;
|
$light-grey: #EEEEEE;
|
||||||
$grey: #E7E7E7;
|
$grey: #E7E7E7;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user