mirror of
https://github.com/thomasnordquist/MQTT-Explorer.git
synced 2026-09-11 17:13:53 +00:00
30 lines
1001 B
TypeScript
30 lines
1001 B
TypeScript
import * as React from 'react'
|
|
import { ChartParameters } from '../../reducers/Charts'
|
|
import { Typography, Theme, withStyles } from '@material-ui/core'
|
|
|
|
function ChartTitle(props: { parameters: ChartParameters; classes: any }) {
|
|
const { classes, parameters } = props
|
|
return (
|
|
<div style={{ flexGrow: 1, overflow: 'hidden', textOverflow: 'ellipsis' }}>
|
|
<Typography variant="caption" className={classes.topic}>
|
|
{parameters.dotPath ? parameters.dotPath : parameters.topic}
|
|
</Typography>
|
|
<br />
|
|
<Typography variant="caption" className={classes.topic}>
|
|
{parameters.dotPath ? parameters.topic : <span dangerouslySetInnerHTML={{ __html: ' ' }}></span>}
|
|
</Typography>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
const styles = (theme: Theme) => ({
|
|
topic: {
|
|
wordBreak: 'break-all' as 'break-all',
|
|
whiteSpace: 'nowrap' as 'nowrap',
|
|
overflow: 'hidden' as 'hidden',
|
|
textOverflow: 'ellipsis' as 'ellipsis',
|
|
},
|
|
})
|
|
|
|
export default withStyles(styles)(ChartTitle)
|