06b1a1a25c
* Added back button * Added back button * Added back button * Fixed Album size overflow * Fixed Album size overflow * Fixed album size overflowing * Fixed album size overflowing * Fixed album size overflowing * Fixed album size overflow on small screen * Changes reverted in PlayerEdit.js * prettier formatting issue resolved Co-authored-by: Deluan <deluan@navidrome.org>
28 lines
657 B
JavaScript
28 lines
657 B
JavaScript
import React from 'react'
|
|
import PropTypes from 'prop-types'
|
|
import { formatBytes } from '../utils'
|
|
import { useRecordContext } from 'react-admin'
|
|
import { makeStyles } from '@material-ui/core'
|
|
|
|
const useStyles = makeStyles((theme) => ({
|
|
root: {
|
|
display: 'inline-block',
|
|
},
|
|
}))
|
|
|
|
export const SizeField = ({ source, ...rest }) => {
|
|
const classes = useStyles()
|
|
const record = useRecordContext(rest)
|
|
return <span className={classes.root}>{formatBytes(record[source])}</span>
|
|
}
|
|
|
|
SizeField.propTypes = {
|
|
label: PropTypes.string,
|
|
record: PropTypes.object,
|
|
source: PropTypes.string.isRequired,
|
|
}
|
|
|
|
SizeField.defaultProps = {
|
|
addLabel: true,
|
|
}
|