Move star to end of album title. Use flex for album details

This commit is contained in:
Deluan
2020-11-15 22:00:40 -05:00
parent cf90f0a245
commit fddded3260
+75 -73
View File
@@ -7,7 +7,6 @@ import {
Collapse, Collapse,
makeStyles, makeStyles,
IconButton, IconButton,
Fab,
useMediaQuery, useMediaQuery,
} from '@material-ui/core' } from '@material-ui/core'
import classnames from 'classnames' import classnames from 'classnames'
@@ -26,7 +25,7 @@ import {
} from '../common' } from '../common'
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
container: { root: {
[theme.breakpoints.down('xs')]: { [theme.breakpoints.down('xs')]: {
padding: '0.7em', padding: '0.7em',
minWidth: '24em', minWidth: '24em',
@@ -36,47 +35,42 @@ const useStyles = makeStyles((theme) => ({
minWidth: '32em', minWidth: '32em',
}, },
}, },
starButton: { cardContents: {
bottom: theme.spacing(-1.5), display: 'flex',
right: theme.spacing(-1.5),
}, },
albumCover: { details: {
display: 'inline-flex', display: 'flex',
justifyContent: 'flex-end', flexDirection: 'column',
alignItems: 'flex-end', },
cursor: 'pointer', content: {
flex: '2 0 auto',
},
coverParent: {
[theme.breakpoints.down('xs')]: { [theme.breakpoints.down('xs')]: {
height: '8em', height: '8em',
width: '8em', width: '8em',
minWidth: '8em',
}, },
[theme.breakpoints.up('sm')]: { [theme.breakpoints.up('sm')]: {
height: '10em', height: '10em',
width: '10em', width: '10em',
minWidth: '10em',
}, },
[theme.breakpoints.up('lg')]: { [theme.breakpoints.up('lg')]: {
height: '15em', height: '15em',
width: '15em', width: '15em',
minWidth: '15em',
}, },
}, },
cover: {
albumDetails: { cursor: 'pointer',
display: 'inline-block', display: 'block',
verticalAlign: 'top', width: '100%',
[theme.breakpoints.down('xs')]: { height: 'auto',
width: '14em',
},
[theme.breakpoints.up('sm')]: {
width: '26em',
},
[theme.breakpoints.up('lg')]: {
width: '43em',
},
}, },
albumTitle: { starButton: {
whiteSpace: 'nowrap', top: theme.spacing(-0.2),
overflow: 'hidden', left: theme.spacing(0.5),
textOverflow: 'ellipsis',
}, },
comment: { comment: {
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
@@ -194,54 +188,62 @@ const AlbumDetails = ({ record }) => {
[] []
) )
return ( return (
<Card className={classes.container}> <Card className={classes.root}>
<CardMedia <div className={classes.cardContents}>
image={imageUrl} <div className={classes.coverParent}>
className={classes.albumCover} <CardMedia
onClick={handleOpenLightbox} component={'img'}
> src={imageUrl}
<StarButton width="400"
className={classes.starButton} height="400"
record={record} className={classes.cover}
resource={'album'} onClick={handleOpenLightbox}
size={isDesktop ? 'default' : 'small'} title={record.name}
aria-label="star"
color="primary"
component={Fab}
/>
</CardMedia>
<CardContent className={classes.albumDetails}>
<Typography variant="h5" className={classes.albumTitle}>
{record.name}
</Typography>
<Typography component="h6">
<ArtistLinkField record={record} />
</Typography>
<Typography component="p">{genreYear(record)}</Typography>
<Typography component="p">
{record.songCount}{' '}
{translate('resources.song.name', { smart_count: record.songCount })}
{' · '} <DurationField record={record} source={'duration'} /> {' · '}
<SizeField record={record} source="size" />
</Typography>
{isDesktop && record['comment'] && (
<AlbumComment
classes={classes}
record={record}
commentNumLines={commentNumLines}
/>
)}
</CardContent>
{!isDesktop && record['comment'] && (
<div>
<AlbumComment
classes={classes}
record={record}
commentNumLines={commentNumLines}
/> />
</div> </div>
<div className={classes.details}>
<CardContent className={classes.content}>
<Typography variant="h5">
{record.name}
<StarButton
className={classes.starButton}
record={record}
resource={'album'}
size={isDesktop ? 'default' : 'small'}
aria-label="star"
color="primary"
/>
</Typography>
<Typography component="h6">
<ArtistLinkField record={record} />
</Typography>
<Typography component="p">{genreYear(record)}</Typography>
<Typography component="p">
{record.songCount}{' '}
{translate('resources.song.name', {
smart_count: record.songCount,
})}
{' · '} <DurationField record={record} source={'duration'} />{' '}
{' · '}
<SizeField record={record} source="size" />
</Typography>
{isDesktop && record['comment'] && (
<AlbumComment
classes={classes}
record={record}
commentNumLines={commentNumLines}
/>
)}
</CardContent>
</div>
</div>
{!isDesktop && record['comment'] && (
<AlbumComment
classes={classes}
record={record}
commentNumLines={commentNumLines}
/>
)} )}
{isLightboxOpen && ( {isLightboxOpen && (
<Lightbox <Lightbox
imagePadding={50} imagePadding={50}