2016-01-22 23:41:35 +00:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import Autolinker from 'autolinker';
|
|
|
|
import pure from 'pure-render-decorator';
|
|
|
|
import { timestamp } from '../util';
|
|
|
|
|
|
|
|
@pure
|
|
|
|
export default class Search extends Component {
|
|
|
|
render() {
|
|
|
|
const { result } = this.props;
|
|
|
|
const content = Autolinker.link(result.content, { stripPrefix: false });
|
|
|
|
|
|
|
|
const style = {
|
2016-02-04 02:35:50 +00:00
|
|
|
paddingLeft: `${window.messageIndent}px`,
|
|
|
|
textIndent: `-${window.messageIndent}px`
|
2016-01-22 23:41:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<p className="search-result" style={style}>
|
|
|
|
<span className="message-time">{timestamp(new Date(result.time * 1000))}</span>
|
|
|
|
<span>
|
|
|
|
{' '}
|
|
|
|
<span className="message-sender">{result.from}</span>
|
|
|
|
</span>
|
2016-02-04 02:35:50 +00:00
|
|
|
<span dangerouslySetInnerHTML={{ __html: ` ${content}` }}></span>
|
2016-01-22 23:41:35 +00:00
|
|
|
</p>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|