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

Commit

Permalink
Use hard-coded values for IE11 / browsers that don't support variable…
Browse files Browse the repository at this point in the history
…s - use the varible by default otherwise
  • Loading branch information
Marc-André Rivet committed Apr 17, 2020
1 parent 7e9601b commit 345918a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
14 changes: 9 additions & 5 deletions src/core/environment/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import { Edge } from 'dash-table/derived/edges/type';
const DASH_DEBUG = 'dash_debug';
const DASH_LOG = 'dash_log';

const DEFAULT_EDGE: Edge = '1px solid #d3d3d3';
const ACTIVE_EDGE: Edge = '1px solid hotpink';

interface ISearchParams {
get: (key: string) => string | null;
}

export default class Environment {
private static readonly _supportsCssVariables = Boolean(window.CSS?.supports?.('.some-selector', 'var(--some-var)'));
private static readonly _activeEdge: Edge = Environment._supportsCssVariables ? '1px solid var(--accent)' : '1px solid hotpink';

public static get searchParams(): ISearchParams {
return (
typeof URL !== 'undefined' &&
Expand All @@ -40,10 +40,14 @@ export default class Environment {
}

public static get defaultEdge(): Edge {
return DEFAULT_EDGE;
return '1px solid #d3d3d3';
}

public static get activeEdge(): Edge {
return ACTIVE_EDGE;
return Environment._activeEdge;
}

public static get supportsCssVariables(): boolean {
return Environment._supportsCssVariables;
}
}
1 change: 1 addition & 0 deletions src/dash-table/components/Table/Table.less
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@
--background-color-ellipses: rgb(253, 253, 253);
--faded-text: rgb(250, 250, 250);
--faded-text-header: rgb(180, 180, 180);
--selected-background: rgba(255, 65, 54, 0.2)
--faded-dropdown: rgb(240, 240, 240);
--muted: rgb(200, 200, 200);
}
Expand Down
5 changes: 4 additions & 1 deletion src/dash-table/derived/cell/wrapperStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import { IConvertedStyle, getDataCellStyle, getDataOpCellStyle } from '../style'
import { traverseMap2, shallowClone } from 'core/math/matrixZipMap';

import isActiveCell from 'dash-table/derived/cell/isActive';
import Environment from 'core/environment';

const SELECTED_CELL_STYLE = { backgroundColor: 'rgba(255, 65, 54, 0.2)' };
const SELECTED_CELL_STYLE = {
backgroundColor: Environment.supportsCssVariables ? 'var(--selected-background)' : 'rgba(255, 65, 54, 0.2)'
};

const partialGetter = (
columns: Columns,
Expand Down

0 comments on commit 345918a

Please sign in to comment.