Migrate SearchResultTile to TypeScript
This commit is contained in:
parent
3d5117c631
commit
d47194e61d
2 changed files with 17 additions and 21 deletions
|
@ -267,7 +267,7 @@ interface IProps {
|
||||||
showReactions?: boolean;
|
showReactions?: boolean;
|
||||||
|
|
||||||
// which layout to use
|
// which layout to use
|
||||||
layout: Layout;
|
layout?: Layout;
|
||||||
|
|
||||||
// whether or not to show flair at all
|
// whether or not to show flair at all
|
||||||
enableFlair?: boolean;
|
enableFlair?: boolean;
|
||||||
|
|
|
@ -16,31 +16,27 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import EventTile, { haveTileForEvent } from "./EventTile";
|
||||||
import * as sdk from '../../../index';
|
import DateSeparator from '../messages/DateSeparator';
|
||||||
import { haveTileForEvent } from "./EventTile";
|
|
||||||
import SettingsStore from "../../../settings/SettingsStore";
|
import SettingsStore from "../../../settings/SettingsStore";
|
||||||
import { UIFeature } from "../../../settings/UIFeature";
|
import { UIFeature } from "../../../settings/UIFeature";
|
||||||
|
import { RoomPermalinkCreator } from '../../../utils/permalinks/Permalinks';
|
||||||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||||
|
|
||||||
|
interface IProps {
|
||||||
|
// a matrix-js-sdk SearchResult containing the details of this result
|
||||||
|
searchResult: any;
|
||||||
|
// a list of strings to be highlighted in the results
|
||||||
|
searchHighlights?: string[];
|
||||||
|
// href for the highlights in this result
|
||||||
|
resultLink?: string;
|
||||||
|
onHeightChanged?: () => void;
|
||||||
|
permalinkCreator?: RoomPermalinkCreator;
|
||||||
|
}
|
||||||
|
|
||||||
@replaceableComponent("views.rooms.SearchResultTile")
|
@replaceableComponent("views.rooms.SearchResultTile")
|
||||||
export default class SearchResultTile extends React.Component {
|
export default class SearchResultTile extends React.Component<IProps> {
|
||||||
static propTypes = {
|
public render() {
|
||||||
// a matrix-js-sdk SearchResult containing the details of this result
|
|
||||||
searchResult: PropTypes.object.isRequired,
|
|
||||||
|
|
||||||
// a list of strings to be highlighted in the results
|
|
||||||
searchHighlights: PropTypes.array,
|
|
||||||
|
|
||||||
// href for the highlights in this result
|
|
||||||
resultLink: PropTypes.string,
|
|
||||||
|
|
||||||
onHeightChanged: PropTypes.func,
|
|
||||||
};
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const DateSeparator = sdk.getComponent('messages.DateSeparator');
|
|
||||||
const EventTile = sdk.getComponent('rooms.EventTile');
|
|
||||||
const result = this.props.searchResult;
|
const result = this.props.searchResult;
|
||||||
const mxEv = result.context.getEvent();
|
const mxEv = result.context.getEvent();
|
||||||
const eventId = mxEv.getId();
|
const eventId = mxEv.getId();
|
Loading…
Add table
Add a link
Reference in a new issue