Apply prettier formatting
This commit is contained in:
parent
1cac306093
commit
526645c791
1576 changed files with 65385 additions and 62478 deletions
|
@ -20,8 +20,8 @@ import * as React from "react";
|
|||
import classNames from "classnames";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
import { _t } from '../../languageHandler';
|
||||
import AutoHideScrollbar from './AutoHideScrollbar';
|
||||
import { _t } from "../../languageHandler";
|
||||
import AutoHideScrollbar from "./AutoHideScrollbar";
|
||||
import AccessibleButton from "../views/elements/AccessibleButton";
|
||||
import { PosthogScreenTracker, ScreenName } from "../../PosthogTrackers";
|
||||
|
||||
|
@ -47,8 +47,8 @@ export class Tab {
|
|||
}
|
||||
|
||||
export enum TabLocation {
|
||||
LEFT = 'left',
|
||||
TOP = 'top',
|
||||
LEFT = "left",
|
||||
TOP = "top",
|
||||
}
|
||||
|
||||
interface IProps {
|
||||
|
@ -67,7 +67,7 @@ export default class TabbedView extends React.Component<IProps, IState> {
|
|||
constructor(props: IProps) {
|
||||
super(props);
|
||||
|
||||
const initialTabIdIsValid = props.tabs.find(tab => tab.id === props.initialTabId);
|
||||
const initialTabIdIsValid = props.tabs.find((tab) => tab.id === props.initialTabId);
|
||||
this.state = {
|
||||
activeTabId: initialTabIdIsValid ? props.initialTabId : props.tabs[0]?.id,
|
||||
};
|
||||
|
@ -78,7 +78,7 @@ export default class TabbedView extends React.Component<IProps, IState> {
|
|||
};
|
||||
|
||||
private getTabById(id: string): Tab | undefined {
|
||||
return this.props.tabs.find(tab => tab.id === id);
|
||||
return this.props.tabs.find((tab) => tab.id === id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -116,10 +116,8 @@ export default class TabbedView extends React.Component<IProps, IState> {
|
|||
onClick={onClickHandler}
|
||||
data-testid={`settings-tab-${tab.id}`}
|
||||
>
|
||||
{ tabIcon }
|
||||
<span className="mx_TabbedView_tabLabel_text">
|
||||
{ label }
|
||||
</span>
|
||||
{tabIcon}
|
||||
<span className="mx_TabbedView_tabLabel_text">{label}</span>
|
||||
</AccessibleButton>
|
||||
);
|
||||
}
|
||||
|
@ -127,31 +125,27 @@ export default class TabbedView extends React.Component<IProps, IState> {
|
|||
private renderTabPanel(tab: Tab): React.ReactNode {
|
||||
return (
|
||||
<div className="mx_TabbedView_tabPanel" key={"mx_tabpanel_" + tab.label}>
|
||||
<AutoHideScrollbar className='mx_TabbedView_tabPanelContent'>
|
||||
{ tab.body }
|
||||
</AutoHideScrollbar>
|
||||
<AutoHideScrollbar className="mx_TabbedView_tabPanelContent">{tab.body}</AutoHideScrollbar>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
public render(): React.ReactNode {
|
||||
const labels = this.props.tabs.map(tab => this.renderTabLabel(tab));
|
||||
const labels = this.props.tabs.map((tab) => this.renderTabLabel(tab));
|
||||
const tab = this.getTabById(this.state.activeTabId);
|
||||
const panel = tab ? this.renderTabPanel(tab) : null;
|
||||
|
||||
const tabbedViewClasses = classNames({
|
||||
'mx_TabbedView': true,
|
||||
'mx_TabbedView_tabsOnLeft': this.props.tabLocation == TabLocation.LEFT,
|
||||
'mx_TabbedView_tabsOnTop': this.props.tabLocation == TabLocation.TOP,
|
||||
mx_TabbedView: true,
|
||||
mx_TabbedView_tabsOnLeft: this.props.tabLocation == TabLocation.LEFT,
|
||||
mx_TabbedView_tabsOnTop: this.props.tabLocation == TabLocation.TOP,
|
||||
});
|
||||
|
||||
return (
|
||||
<div className={tabbedViewClasses}>
|
||||
<PosthogScreenTracker screenName={tab?.screenName ?? this.props.screenName} />
|
||||
<div className="mx_TabbedView_tabLabels">
|
||||
{ labels }
|
||||
</div>
|
||||
{ panel }
|
||||
<div className="mx_TabbedView_tabLabels">{labels}</div>
|
||||
{panel}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue