Skip to content

Commit

Permalink
fix: folder prop is not required
Browse files Browse the repository at this point in the history
closes #84
  • Loading branch information
juancarlosfarah committed May 27, 2019
1 parent 2d2b003 commit 9b7a3e2
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/components/space/SpaceGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SpaceGrid extends Component {
};

static propTypes = {
folder: PropTypes.string.isRequired,
folder: PropTypes.string,
classes: PropTypes.shape({
leftIcon: PropTypes.string.isRequired,
}).isRequired,
Expand All @@ -34,6 +34,10 @@ class SpaceGrid extends Component {
dispatchClearSpace: PropTypes.func.isRequired,
};

static defaultProps = {
folder: null,
};

componentDidMount() {
const { dispatchClearSpace } = this.props;
dispatchClearSpace();
Expand All @@ -52,11 +56,13 @@ class SpaceGrid extends Component {
} = image;

// prioritise assets
if (thumbnailAsset) {
return `file://${folder}/${thumbnailAsset}`;
}
if (backgroundAsset) {
return `file://${folder}/${backgroundAsset}`;
if (folder) {
if (thumbnailAsset) {
return `file://${folder}/${thumbnailAsset}`;
}
if (backgroundAsset) {
return `file://${folder}/${backgroundAsset}`;
}
}

// fallback on urls
Expand Down

0 comments on commit 9b7a3e2

Please sign in to comment.