aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/MainView.tsx16
-rw-r--r--src/client/views/StyleProvider.tsx3
2 files changed, 6 insertions, 13 deletions
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index 58cc1c0d2..5d26404ff 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -66,8 +66,7 @@ export class MainView extends React.Component {
public static Instance: MainView;
private _docBtnRef = React.createRef<HTMLDivElement>();
private _mainViewRef = React.createRef<HTMLDivElement>();
- @observable private _lastButton: Doc | undefined;
-
+ @observable public LastButton: Opt<Doc>;
@observable private _panelWidth: number = 0;
@observable private _panelHeight: number = 0;
@observable private _panelContent: string = "none";
@@ -298,13 +297,6 @@ export class MainView extends React.Component {
doc.dockingConfig ? CurrentUserUtils.openDashboard(Doc.UserDoc(), doc) : CollectionDockingView.AddSplit(doc, "right");
}
- menuStyleProvider = (doc: Doc | undefined, props: Opt<DocumentViewProps>, property: string) => {
- if (property === StyleProp.ItemBackgroundColor && this._lastButton === doc) {
- return this.darkScheme ? "dimgrey" : "lightgrey";
- }
- return DefaultStyleProvider(doc, props, property);
- }
-
@computed get flyout() {
return !this._flyoutWidth ? <div className={`mainView-libraryFlyout-out`}>
{this.docButtons}
@@ -359,7 +351,7 @@ export class MainView extends React.Component {
PanelHeight={this.getContentsHeight}
renderDepth={0}
focus={emptyFunction}
- styleProvider={this.menuStyleProvider}
+ styleProvider={DefaultStyleProvider}
parentActive={returnTrue}
whenActiveChanged={emptyFunction}
bringToFront={emptyFunction}
@@ -432,11 +424,11 @@ export class MainView extends React.Component {
expandFlyout = action((button: Doc) => {
this._flyoutWidth = (this._flyoutWidth || 250);
this._sidebarContent.proto = button.target as any;
- this._lastButton = button;
+ this.LastButton = button;
});
closeFlyout = action(() => {
- this._lastButton = undefined;
+ this.LastButton = undefined;
this._panelContent = "none";
this._sidebarContent.proto = undefined;
this._flyoutWidth = 0;
diff --git a/src/client/views/StyleProvider.tsx b/src/client/views/StyleProvider.tsx
index adf47ec57..f51e94cfd 100644
--- a/src/client/views/StyleProvider.tsx
+++ b/src/client/views/StyleProvider.tsx
@@ -15,7 +15,7 @@ import "./StyleProvider.scss";
import React = require("react");
import Color = require('color');
import { listSpec } from '../../fields/Schema';
-import { Utils } from '../../Utils';
+import { MainView } from './MainView';
export enum StyleLayers {
Background = "background"
@@ -79,6 +79,7 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<DocumentViewProps
case StyleProp.ItemBackgroundColor:
let docColor: Opt<string> = StrCast(doc?._backgroundColor, StrCast(doc?.backgroundColor));
if (docColor) return docColor;
+ if (MainView.Instance.LastButton === doc) return darkScheme() ? "dimgrey" : "lightgrey";
switch (doc?.type) {
case DocumentType.FONTICON: return "black";
case DocumentType.LINK: return "lightblue";