Initial support for song browsing from UI

This commit is contained in:
Deluan
2020-01-22 10:19:13 -05:00
parent fdf1ceeade
commit 9557f7ceed
17 changed files with 158 additions and 28 deletions
+18
View File
@@ -0,0 +1,18 @@
import React from 'react'
import PropTypes from 'prop-types'
const BitrateField = ({ record = {}, source }) => {
return <span>{`${record[source]} kbps`}</span>
}
BitrateField.propTypes = {
label: PropTypes.string,
record: PropTypes.object,
source: PropTypes.string.isRequired
}
BitrateField.defaultProps = {
addLabel: true
}
export default BitrateField
+25
View File
@@ -0,0 +1,25 @@
import React from 'react'
import PropTypes from 'prop-types'
const DurationField = ({ record = {}, source }) => {
return <span>{format(record[source])}</span>
}
const format = (d) => {
const date = new Date(null)
date.setSeconds(d)
const fmt = date.toISOString().substr(11, 8)
return fmt.replace(/^00:/, '')
}
DurationField.propTypes = {
label: PropTypes.string,
record: PropTypes.object,
source: PropTypes.string.isRequired
}
DurationField.defaultProps = {
addLabel: true
}
export default DurationField
+7
View File
@@ -0,0 +1,7 @@
import React from 'react'
const Title = ({ subTitle }) => {
return <span>CloudSonic {subTitle ? ` - ${subTitle}` : ''}</span>
}
export default Title
+5
View File
@@ -0,0 +1,5 @@
import Title from './Title'
import DurationField from './DurationField'
import BitrateField from './BitrateField'
export { Title, DurationField, BitrateField }