Skip to content

Commit

Permalink
Moved collapse action up to the page component (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
DalerAsrorov committed Nov 17, 2017
1 parent b39ba58 commit bdd0eb1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/components/FooterPanel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export const FooterPanel = props => {
isOpen={props.isOpen}
canScrollUp={props.canScrollUp}
className={props.classes.settings}
onCollapse={props.onCollapse}
/>
</section>
</Toolbar>
Expand All @@ -84,6 +85,7 @@ export const FooterPanel = props => {
FooterPanel.propTypes = {
onClickOptions: PropTypes.func.isRequired,
onSelectItem: PropTypes.func.isRequired,
onCollapse: PropTypes.func.isRequired,
mainText: PropTypes.string.isRequired,
classes: PropTypes.object.isRequired,
onClick: PropTypes.func.isRequired,
Expand Down
7 changes: 6 additions & 1 deletion src/components/MyPlaylists/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ let scroll = Scroll.animateScroll;

class MyPlaylists extends PureComponent {
static propTypes = {
setOpenStatusMyPlaylists: PropTypes.func.isRequired,
fetchMyPlaylists: PropTypes.func.isRequired,
myPlaylists: MY_PLAYLISTS_PROPTYPE.isRequired,
classes: PropTypes.object.isRequired
Expand All @@ -44,7 +45,6 @@ class MyPlaylists extends PureComponent {

const {
fetchMyPlaylists,
setOpenStatusMyPlaylists,
myPlaylists: { numberOfTracks, currentOffset, playlistsRemaining }
} = this.props;

Expand Down Expand Up @@ -78,6 +78,10 @@ class MyPlaylists extends PureComponent {
});
};

_handleClickCollapse = () => {
this.props.setOpenStatusMyPlaylists();
};

componentDidMount() {
let { currentOffset } = this.state;
const {
Expand Down Expand Up @@ -138,6 +142,7 @@ class MyPlaylists extends PureComponent {
mainText={status}
anchorEl={anchorEl}
canScrollUp={canScrollUp}
onCollapse={this._handleClickCollapse}
/>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/Settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ let scroll = Scroll.animateScroll;

class Settings extends PureComponent {
static propTypes = {
setOpenStatusMyPlaylists: PropTypes.func.isRequired,
onClickOptions: PropTypes.func.isRequired,
onSelectItem: PropTypes.func.isRequired,
canScrollUp: PropTypes.bool.isRequired,
onCollapse: PropTypes.func.isRequired,
anchorEl: PropTypes.object,
isOpen: PropTypes.bool
};
Expand All @@ -39,7 +39,7 @@ class Settings extends PureComponent {
};

_handleClickPlaylistCollapse = () => {
this.props.setOpenStatusMyPlaylists();
this.props.onCollapse();
this.props.onSelectItem();
};

Expand Down

0 comments on commit bdd0eb1

Please sign in to comment.