You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.2 KiB
69 lines
1.2 KiB
7 years ago
|
import PropTypes from 'prop-types';
|
||
|
import React, { Component } from 'react';
|
||
|
import Link from 'Components/Link/Link';
|
||
7 years ago
|
import AlbumDetailsModal from 'Album/AlbumDetailsModal';
|
||
|
import styles from './AlbumTitleLink.css';
|
||
7 years ago
|
|
||
7 years ago
|
class AlbumTitleLink extends Component {
|
||
7 years ago
|
|
||
|
//
|
||
|
// Lifecycle
|
||
|
|
||
|
constructor(props, context) {
|
||
|
super(props, context);
|
||
|
|
||
|
this.state = {
|
||
|
isDetailsModalOpen: false
|
||
|
};
|
||
|
}
|
||
|
|
||
|
//
|
||
|
// Listeners
|
||
|
|
||
|
onLinkPress = () => {
|
||
|
this.setState({ isDetailsModalOpen: true });
|
||
|
}
|
||
|
|
||
|
onModalClose = () => {
|
||
|
this.setState({ isDetailsModalOpen: false });
|
||
|
}
|
||
|
|
||
|
//
|
||
|
// Render
|
||
|
|
||
|
render() {
|
||
|
const {
|
||
7 years ago
|
albumTitle,
|
||
7 years ago
|
...otherProps
|
||
|
} = this.props;
|
||
|
|
||
|
return (
|
||
|
<div>
|
||
|
<Link
|
||
|
className={styles.link}
|
||
|
onPress={this.onLinkPress}
|
||
|
>
|
||
7 years ago
|
{albumTitle}
|
||
7 years ago
|
</Link>
|
||
|
|
||
7 years ago
|
<AlbumDetailsModal
|
||
7 years ago
|
isOpen={this.state.isDetailsModalOpen}
|
||
7 years ago
|
albumTitle={albumTitle}
|
||
7 years ago
|
{...otherProps}
|
||
|
onModalClose={this.onModalClose}
|
||
|
/>
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
7 years ago
|
AlbumTitleLink.propTypes = {
|
||
|
albumTitle: PropTypes.string.isRequired
|
||
7 years ago
|
};
|
||
|
|
||
7 years ago
|
AlbumTitleLink.defaultProps = {
|
||
7 years ago
|
showArtistButton: false
|
||
7 years ago
|
};
|
||
|
|
||
7 years ago
|
export default AlbumTitleLink;
|