react-building-blocks
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -11,2 +11,6 @@ 'use strict'; | ||
var _SidebarHeader = require('../SidebarHeader/SidebarHeader'); | ||
var _SidebarHeader2 = _interopRequireDefault(_SidebarHeader); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -42,6 +46,7 @@ | ||
className = _props.className, | ||
header = _props.header, | ||
height = _props.height, | ||
style = _props.style, | ||
width = _props.width, | ||
props = _objectWithoutProperties(_props, ['children', 'className', 'height', 'style', 'width']); | ||
props = _objectWithoutProperties(_props, ['children', 'className', 'header', 'height', 'style', 'width']); | ||
@@ -62,2 +67,7 @@ if (height && !style.height) { | ||
}, props), | ||
header ? _react2.default.createElement( | ||
_SidebarHeader2.default, | ||
null, | ||
header | ||
) : null, | ||
children | ||
@@ -86,2 +96,3 @@ ); | ||
className: _react.PropTypes.string, | ||
header: _react.PropTypes.node, | ||
height: _react.PropTypes.string, | ||
@@ -88,0 +99,0 @@ style: _react.PropTypes.object, |
@@ -28,3 +28,7 @@ 'use strict'; | ||
_Sidebar2.default, | ||
null, | ||
{ header: _react2.default.createElement( | ||
'a', | ||
{ href: '/' }, | ||
'Site Title' | ||
) }, | ||
_react2.default.createElement( | ||
@@ -38,11 +42,2 @@ _SidebarModule2.default, | ||
) | ||
), | ||
_react2.default.createElement( | ||
_SidebarModule2.default, | ||
null, | ||
_react2.default.createElement( | ||
'p', | ||
null, | ||
'More Content' | ||
) | ||
) | ||
@@ -60,5 +55,9 @@ )); | ||
it('renders all children', function () { | ||
expect(renderedDOM().children.length).toEqual(2); | ||
it('renders SidebarHeader', function () { | ||
expect(renderedDOM().children[0].tagName).toEqual('HEADER'); | ||
}); | ||
it('renders SidebarModule children', function () { | ||
expect(renderedDOM().children[1].tagName).toEqual('DIV'); | ||
}); | ||
}); |
@@ -5,4 +5,5 @@ 'use strict'; | ||
Sidebar: require('./components/Sidebar/Sidebar'), | ||
SidebarHeader: require('./components/SidebarHeader/SidebarHeader'), | ||
SidebarModule: require('./components/SidebarModule/SidebarModule'), | ||
SidebarModuleHeader: require('./components/SidebarModuleHeader/SidebarModuleHeader') | ||
}; |
@@ -14,2 +14,3 @@ // npm modules | ||
<li><Link to='/components/sidebar'>Sidebar</Link></li> | ||
<li><Link to='/components/sidebar-header'>SidebarHeader</Link></li> | ||
<li><Link to='/components/sidebar-module'>SidebarModule</Link></li> | ||
@@ -16,0 +17,0 @@ <li><Link to='/components/sidebar-module-header'>SidebarModuleHeader</Link></li> |
@@ -10,2 +10,3 @@ // npm modules | ||
import Sidebar from 'components/SidebarDocs'; | ||
import SidebarHeader from 'components/SidebarHeaderDocs'; | ||
import SidebarModule from 'components/SidebarModuleDocs'; | ||
@@ -30,2 +31,3 @@ import SidebarModuleHeader from 'components/SidebarModuleHeaderDocs'; | ||
<Route component={Sidebar} path='sidebar' /> | ||
<Route component={SidebarHeader} path='sidebar-header' /> | ||
<Route component={SidebarModule} path='sidebar-module' /> | ||
@@ -32,0 +34,0 @@ <Route component={SidebarModuleHeader} path='sidebar-module-header' /> |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"scripts": { | ||
@@ -11,0 +11,0 @@ "dev": "cd docs && npm install && open 'http://localhost:8080' && NODE_ENV=development webpack-dev-server --inline --hot", |
import React, { Component, PropTypes } from 'react'; | ||
import SidebarHeader from '../SidebarHeader/SidebarHeader'; | ||
@@ -14,3 +15,3 @@ class Sidebar extends Component { | ||
render() { | ||
const {children, className, height, style, width, ...props} = this.props; | ||
const {children, className, header, height, style, width, ...props} = this.props; | ||
@@ -34,2 +35,8 @@ if (height && !style.height) { | ||
> | ||
{ | ||
header | ||
? <SidebarHeader>{header}</SidebarHeader> | ||
: null | ||
} | ||
{children} | ||
@@ -56,2 +63,3 @@ </aside> | ||
className: PropTypes.string, | ||
header: PropTypes.node, | ||
height: PropTypes.string, | ||
@@ -58,0 +66,0 @@ style: PropTypes.object, |
@@ -9,5 +9,4 @@ import React from 'react'; | ||
const component = TestUtils.renderIntoDocument( | ||
<Sidebar> | ||
<Sidebar header={<a href="/">Site Title</a>}> | ||
<SidebarModule><p>Content</p></SidebarModule> | ||
<SidebarModule><p>More Content</p></SidebarModule> | ||
</Sidebar> | ||
@@ -25,6 +24,11 @@ ); | ||
it('renders all children', () => { | ||
expect(renderedDOM().children.length) | ||
.toEqual(2); | ||
it('renders SidebarHeader', () => { | ||
expect(renderedDOM().children[0].tagName) | ||
.toEqual('HEADER'); | ||
}); | ||
it('renders SidebarModule children', () => { | ||
expect(renderedDOM().children[1].tagName) | ||
.toEqual('DIV'); | ||
}); | ||
}); |
@@ -12,7 +12,3 @@ import React, { Component, PropTypes } from 'react'; | ||
header | ||
? ( | ||
<SidebarModuleHeader> | ||
{header} | ||
</SidebarModuleHeader> | ||
) | ||
? <SidebarModuleHeader>{header}</SidebarModuleHeader> | ||
: null | ||
@@ -19,0 +15,0 @@ } |
module.exports = { | ||
Sidebar: require('./components/Sidebar/Sidebar'), | ||
SidebarHeader: require('./components/SidebarHeader/SidebarHeader'), | ||
SidebarModule: require('./components/SidebarModule/SidebarModule'), | ||
SidebarModuleHeader: require('./components/SidebarModuleHeader/SidebarModuleHeader') | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
245022
31
1523