mirror of
https://github.com/ascribe/onion.git
synced 2024-06-30 21:52:08 +02:00
33 lines
955 B
JavaScript
33 lines
955 B
JavaScript
'use strict';
|
|
|
|
import React from 'react';
|
|
|
|
let AccordionList = React.createClass({
|
|
propTypes: {
|
|
className: React.PropTypes.string,
|
|
children: React.PropTypes.arrayOf(React.PropTypes.element).isRequired,
|
|
loadingElement: React.PropTypes.element
|
|
},
|
|
|
|
render() {
|
|
if(this.props.itemList && this.props.itemList.length > 0) {
|
|
return (
|
|
<div className={this.props.className}>
|
|
{this.props.children}
|
|
</div>
|
|
);
|
|
} else if(this.props.itemList.length === 0) {
|
|
return (
|
|
<p className="text-center">You don't have any works yet...</p>
|
|
);
|
|
} else {
|
|
return (
|
|
<div className={this.props.className + ' ascribe-accordion-list-loading'}>
|
|
{this.props.loadingElement}
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
});
|
|
|
|
export default AccordionList; |