Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Use classNames function for appTileBodyClass on AppTile.tsx #10939

Merged
merged 2 commits into from
May 19, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions src/components/views/elements/AppTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,11 @@ export default class AppTile extends React.Component<IProps, IState> {
const iframeFeatures =
"microphone; camera; encrypted-media; autoplay; display-capture; clipboard-write; " + "clipboard-read;";

const appTileBodyClass = "mx_AppTileBody" + (this.props.miniMode ? "_mini " : " ");
const appTileBodyClass = classNames({
mx_AppTileBody: !this.props.miniMode,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mx_AppTileBody is always is present in the previous version

Copy link
Contributor Author

@luixxiul luixxiul May 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because "mx_AppTileBody" + (this.props.miniMode ? "_mini " outputs "mx_AppTileBody_mini " on miniMode.

If miniMode is not enabled, mx_AppTileBody (mind the last white space character) is output.

Here is the how the class name is output on develop.element.io:

1

1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right

mx_AppTileBody_mini: this.props.miniMode,
mx_AppTile_loading: this.state.loading,
});
const appTileBodyStyles: CSSProperties = {};
if (this.props.pointerEvents) {
appTileBodyStyles.pointerEvents = this.props.pointerEvents;
Expand Down Expand Up @@ -626,10 +630,7 @@ export default class AppTile extends React.Component<IProps, IState> {
);
} else if (this.state.initialising || !this.state.isUserProfileReady) {
appTileBody = (
<div
className={appTileBodyClass + (this.state.loading ? "mx_AppTile_loading" : "")}
style={appTileBodyStyles}
>
<div className={appTileBodyClass} style={appTileBodyStyles}>
{loadingElement}
</div>
);
Expand All @@ -642,10 +643,7 @@ export default class AppTile extends React.Component<IProps, IState> {
);
} else {
appTileBody = (
<div
className={appTileBodyClass + (this.state.loading ? "mx_AppTile_loading" : "")}
style={appTileBodyStyles}
>
<div className={appTileBodyClass} style={appTileBodyStyles}>
{this.state.loading && loadingElement}
<iframe
title={widgetTitle}
Expand Down