Migrate SimpleRoomHeader to TypeScript

This commit is contained in:
Germain Souquet 2021-08-14 10:48:30 +02:00
parent 7e4c88f6ba
commit eb120901ae

View file

@ -1,5 +1,6 @@
/* /*
Copyright 2016 OpenMarket Ltd Copyright 2016 OpenMarket Ltd
Copyright 2021 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,23 +16,21 @@ limitations under the License.
*/ */
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import { replaceableComponent } from "../../../utils/replaceableComponent"; import { replaceableComponent } from "../../../utils/replaceableComponent";
interface IProps {
title?: string;
// `src` to an image. Optional.
icon?: string;
}
/* /*
* A stripped-down room header used for things like the user settings * A stripped-down room header used for things like the user settings
* and room directory. * and room directory.
*/ */
@replaceableComponent("views.rooms.SimpleRoomHeader") @replaceableComponent("views.rooms.SimpleRoomHeader")
export default class SimpleRoomHeader extends React.Component { export default class SimpleRoomHeader extends React.PureComponent<IProps> {
static propTypes = { public render(): JSX.Element {
title: PropTypes.string,
// `src` to an image. Optional.
icon: PropTypes.string,
};
render() {
let icon; let icon;
if (this.props.icon) { if (this.props.icon) {
icon = <img icon = <img