import React, { useState } from 'react' import { Typography, Collapse } from '@material-ui/core' import { makeStyles } from '@material-ui/core/styles' import Card from '@material-ui/core/Card' import CardMedia from '@material-ui/core/CardMedia' import config from '../config' import { LoveButton, RatingField } from '../common' import Lightbox from 'react-image-lightbox' import subsonic from '../subsonic' const useStyles = makeStyles( (theme) => ({ root: { display: 'flex', background: ({ img }) => `url(${img})`, }, bgContainer: { display: 'flex', height: '15rem', width: '100vw', padding: 'unset', backdropFilter: 'blur(1px)', backgroundPosition: '50% 30%', background: `linear-gradient(to bottom, rgba(52 52 52 / 72%), rgba(21 21 21))`, }, link: { margin: '1px', }, details: { display: 'flex', alignItems: 'flex-start', flexDirection: 'column', justifyContent: 'center', marginLeft: '0.5rem', }, biography: { display: 'flex', marginLeft: '3%', marginRight: '3%', marginTop: '-2em', zIndex: '1', '& p': { whiteSpace: ({ expanded }) => (expanded ? 'unset' : 'nowrap'), overflow: 'hidden', width: '95vw', textOverflow: 'ellipsis', }, }, cover: { width: 151, boxShadow: '0px 0px 6px 0px #565656', borderRadius: '5px', }, artistImage: { marginLeft: '1em', maxHeight: '7rem', backgroundColor: 'inherit', marginTop: '4rem', width: '7rem', minWidth: '7rem', display: 'flex', borderRadius: '5em', }, loveButton: { top: theme.spacing(-0.2), left: theme.spacing(0.5), }, rating: { marginTop: '5px', }, artistName: { wordBreak: 'break-word', }, }), { name: 'NDMobileArtistDetails' } ) const MobileArtistDetails = ({ artistInfo, biography, record }) => { const img = subsonic.getCoverArtUrl(record) const [expanded, setExpanded] = useState(false) const classes = useStyles({ img, expanded }) const title = record.name const [isLightboxOpen, setLightboxOpen] = React.useState(false) const handleOpenLightbox = React.useCallback(() => setLightboxOpen(true), []) const handleCloseLightbox = React.useCallback( () => setLightboxOpen(false), [] ) return ( <>
{artistInfo && ( )}
{title} {config.enableStarRating && ( )}
setExpanded(!expanded)}>
{isLightboxOpen && ( )} ) } export default MobileArtistDetails