0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-03-25 02:32:52 -05:00

fix: highlight is not a component, must include all dependency 😞

This commit is contained in:
Juan Picado @jotadeveloper 2017-07-22 19:00:13 +02:00
parent f783ec3df3
commit 19490ffc51
No known key found for this signature in database
GPG key ID: 18AC54485952D158
2 changed files with 14 additions and 9 deletions

View file

@ -1,6 +1,6 @@
import React from 'react';
import SyntaxHighlighter from 'react-syntax-highlighter/dist/highlight';
import SyntaxHighlighter from 'react-syntax-highlighter/dist/index';
import sunburst from 'react-syntax-highlighter/src/styles/sunburst';
import classes from './help.scss';

View file

@ -1,5 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import isEmpty from 'lodash/isEmpty';
import Package from '../Package';
import Help from '../Help';
@ -12,18 +13,12 @@ export default class PackageList extends React.Component {
packages: PropTypes.array
}
renderList() {
return this.props.packages.map((pkg, i)=> (
<li key={i}><Package package={pkg} /></li>
));
}
render() {
return (
<div>
<div className={classes.pkgContainer}>
{this.renderTitle()}
{this.props.packages.length ? this.renderList(): <Help/>}
{this.isTherePackages() ? this.renderList(): this.renderHelp()}
</div>
</div>
);
@ -37,7 +32,17 @@ export default class PackageList extends React.Component {
return <h1 className={ classes.listTitle }>Available Packages</h1>;
}
renderList() {
return this.props.packages.map((pkg, i)=> (
<li key={i}><Package package={pkg} /></li>
));
}
renderHelp() {
return <Help/>;
}
isTherePackages() {
return this.props.packages.length > 0;
return isEmpty(this.props.packages) === false;
}
}