Update prop type & documentation for HistoryVisibleBanner and VM. (#31545)
* docs: Update documentation for HistoryVisibleBanner and VM. * docs: Improve documentation for `HistoryVisibleBanner`, second pass. * docs: Move documentation to prop types over FC. Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * fix: Simplify type for `HistoryVisibleBannerViewModel` `threadId`. * docs: Apply suggestions from code review Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> --------- Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
co-authored by
Richard van der Hoff
parent
e696f92bd3
commit
4da149e56f
@@ -11,7 +11,17 @@ import { type Room } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { HistoryVisibleBannerViewModel } from "../../../viewmodels/composer/HistoryVisibleBannerViewModel";
|
||||
|
||||
export const HistoryVisibleBanner: React.FC<{ room: Room; threadId?: string | null }> = (props) => {
|
||||
/** Wrapper around {@link HistoryVisibleBannerViewModel} for the creation of an auto-disposed view model. */
|
||||
export const HistoryVisibleBanner: React.FC<{
|
||||
/** The room instance associated with this banner view model. */
|
||||
room: Room;
|
||||
|
||||
/**
|
||||
* If not null, specifies the ID of the thread currently being viewed in the thread timeline side view,
|
||||
* where the banner view is displayed as a child of the message composer.
|
||||
*/
|
||||
threadId: string | null;
|
||||
}> = (props) => {
|
||||
const vm = useCreateAutoDisposedViewModel(() => new HistoryVisibleBannerViewModel(props));
|
||||
return <HistoryVisibleBannerView vm={vm} />;
|
||||
};
|
||||
|
||||
@@ -675,7 +675,7 @@ export class MessageComposer extends React.Component<IProps, IState> {
|
||||
|
||||
return (
|
||||
<div className={classes} ref={this.ref} role="region" aria-label={_t("a11y|message_composer")}>
|
||||
<HistoryVisibleBanner room={this.props.room} threadId={threadId} />
|
||||
<HistoryVisibleBanner room={this.props.room} threadId={threadId ?? null} />
|
||||
<div className="mx_MessageComposer_wrapper">
|
||||
<UserIdentityWarning room={this.props.room} key={this.props.room.roomId} />
|
||||
<ReplyPreview
|
||||
|
||||
Reference in New Issue
Block a user