Coral UI - List and Item

This commit is contained in:
Belen Curcio
2017-01-12 17:47:45 -03:00
parent 3d65231db5
commit c375d11e32
4 changed files with 11 additions and 9 deletions
@@ -1,4 +1,4 @@
import React from 'react';
import React, {Component} from 'react';
import {connect} from 'react-redux';
import {
fetchSettings,
@@ -16,7 +16,7 @@ import CommentSettings from './CommentSettings';
import Wordlist from './Wordlist';
import has from 'lodash/has';
class Configure extends React.Component {
class Configure extends Component {
constructor (props) {
super(props);
@@ -25,6 +25,8 @@ class Configure extends React.Component {
changed: false,
errors: {}
};
this.changeSection = this.changeSection.bind(this);
}
componentWillMount = () => {
@@ -36,7 +38,7 @@ class Configure extends React.Component {
this.setState({changed: false});
}
changeSection = (activeSection) => () => {
changeSection(activeSection) {
this.setState({activeSection});
}
+3 -2
View File
@@ -1,6 +1,6 @@
.base {
box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px rgba(0,0,0,.2), 0 1px 5px 0 rgba(0,0,0,.12);
background: white;
background-color: white;
width: 235px;
padding: 10px 14px;
font-size: 14px;
@@ -12,7 +12,8 @@
}
&.active {
background: red;
color: white;
background-color: #262626;
}
i {
+2 -3
View File
@@ -14,7 +14,7 @@ export default class List extends Component {
}
render() {
const {children, activeItem, itemId, className = ''} = this.props;
const {children, activeItem, className = ''} = this.props;
return (
<ul className={`${styles.base} ${className}`}>
{React.Children.toArray(children)
@@ -22,8 +22,7 @@ export default class List extends Component {
.map((child, i) =>
React.cloneElement(child, {
i,
itemId: child.props.itemId,
active: itemId === activeItem,
active: child.props.itemId === activeItem,
onItemClick: this.handleClickItem,
})
)}
+1 -1
View File
@@ -5,7 +5,7 @@ export default ({children, tabId, active, onTabClick, cStyle = 'base'}) => (
<li
key={tabId}
className={active ? styles[`${cStyle}--active`] : ''}
onClick={() => onTabClick(tabId)}
onClick={onTabClick(tabId)}
>
{children}
</li>