Show newlines in Web-UI

This commit is contained in:
Jannis Mattheis 2018-11-14 20:08:36 +01:00
parent 0ca18b817c
commit 141193136d
1 changed files with 7 additions and 13 deletions

View File

@ -5,8 +5,9 @@ import Delete from '@material-ui/icons/Delete';
import React from 'react'; import React from 'react';
import TimeAgo from 'react-timeago'; import TimeAgo from 'react-timeago';
import Container from '../common/Container'; import Container from '../common/Container';
import {StyleRulesCallback} from '@material-ui/core/styles/withStyles';
const styles = () => ({ const styles: StyleRulesCallback = () => ({
header: { header: {
display: 'flex', display: 'flex',
}, },
@ -29,18 +30,11 @@ const styles = () => ({
imageWrapper: { imageWrapper: {
display: 'flex', display: 'flex',
}, },
content: {
whiteSpace: 'pre-wrap',
},
}); });
type Style = WithStyles<
| 'header'
| 'headerTitle'
| 'trash'
| 'wrapperPadding'
| 'messageContentWrapper'
| 'image'
| 'imageWrapper'
>;
interface IProps { interface IProps {
title: string; title: string;
image?: string; image?: string;
@ -50,7 +44,7 @@ interface IProps {
height: (height: number) => void; height: (height: number) => void;
} }
class Message extends React.PureComponent<IProps & Style> { class Message extends React.PureComponent<IProps & WithStyles<typeof styles>> {
private node: HTMLDivElement | null; private node: HTMLDivElement | null;
public componentDidMount = () => public componentDidMount = () =>
@ -84,7 +78,7 @@ class Message extends React.PureComponent<IProps & Style> {
<Delete /> <Delete />
</IconButton> </IconButton>
</div> </div>
<Typography component="p" className="content"> <Typography component="p" className={`${classes.content} content`}>
{content} {content}
</Typography> </Typography>
</div> </div>