Skip to content

Commit

Permalink
Merge pull request #580 from toggle-corp/feature-add-empty-message
Browse files Browse the repository at this point in the history
Add empty message prop for empty component
  • Loading branch information
frozenhelium authored Jun 5, 2019
2 parents eb35855 + aecc345 commit 11b44d7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions components/View/VirtualizedListView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import Message from '../Message';
import Responsive from '../../General/Responsive';
import styles from './styles.scss';

const DefaultEmptyComponent = () => {
const DefaultEmptyComponent = ({ message }) => {
const className = `
empty
${styles.empty}
`;

return (
<Message className={className}>
Nothing to show.
{message}
</Message>
);
};
Expand Down Expand Up @@ -47,6 +47,7 @@ const propTypes = {
emptyComponent: PropTypes.func,

minWidth: PropTypes.number,
emptyMessage: PropTypes.string,
};

const defaultProps = {
Expand All @@ -59,6 +60,7 @@ const defaultProps = {
rendererClassName: '',
rendererParams: undefined,
emptyComponent: DefaultEmptyComponent,
emptyMessage: 'Nothing to show.',
minWidth: undefined,
};

Expand Down Expand Up @@ -299,6 +301,7 @@ class VirtualizedListView extends React.Component {
const {
className: classNameFromProps,
emptyComponent: EmptyComponent,
emptyMessage,
data,
id,
minWidth,
Expand All @@ -321,7 +324,9 @@ class VirtualizedListView extends React.Component {
<Items />
{ data.length === 0 && (
<React.Fragment>
{ EmptyComponent && <EmptyComponent /> }
{ EmptyComponent && <EmptyComponent
message={emptyMessage}
/> }
{ minWidth && (
<div
style={{
Expand Down

0 comments on commit 11b44d7

Please sign in to comment.