diff --git a/src/devtools/views/Button.css b/src/devtools/views/Button.css
new file mode 100644
index 0000000000..cd252ef508
--- /dev/null
+++ b/src/devtools/views/Button.css
@@ -0,0 +1,26 @@
+.Button {
+ border: none;
+ background: var(--color-button-background);
+ color: var(--color-button);
+ border-radius: 0.25rem;
+ display: inline-flex;
+ align-items: center;
+ padding: 0.25rem;
+ cursor: pointer;
+ flex: 0 0 auto;
+}
+.Button:hover {
+ background: var(--color-button-background-hover);
+ color: var(--color-button-hover);
+}
+.Button:active,
+.Button:focus {
+ background: var(--color-button-background-focus);
+ color: var(--color-button-focus);
+ outline: none;
+}
+.Button:disabled {
+ background: var(--color-button-background);
+ color: var(--color-button-disabled);
+ cursor: default;
+}
diff --git a/src/devtools/views/Button.js b/src/devtools/views/Button.js
new file mode 100644
index 0000000000..398ec23284
--- /dev/null
+++ b/src/devtools/views/Button.js
@@ -0,0 +1,13 @@
+// @flow
+
+import React from 'react';
+
+import styles from './Button.css';
+
+type Props = {
+ className?: string,
+};
+
+export default function Button({ className, ...rest }: Props) {
+ return ;
+}
diff --git a/src/devtools/views/Element.css b/src/devtools/views/Element.css
index 0c52b4f83e..97b02258a2 100644
--- a/src/devtools/views/Element.css
+++ b/src/devtools/views/Element.css
@@ -18,16 +18,13 @@
/* Invert colors */
--color-component-name: var(--color-component-name-inverted);
- --color-arrow: var(--color-arrow-inverted);
- --color-tree-jsx-arrow-brackets: var(
- --color-tree-jsx-arrow-brackets-inverted
- );
+ --color-jsx-arrow-brackets: var(--color-jsx-arrow-brackets-inverted);
--color-attribute-name: var(--color-tree-node-hover);
--color-attribute-value: var(--color-component-name-inverted);
}
.DollarR {
- color: var(--color-tree-jsx-arrow-brackets);
+ color: var(--color-jsx-arrow-brackets);
}
.Component {
@@ -36,12 +33,12 @@
.Component:before {
white-space: nowrap;
content: '<';
- color: var(--color-tree-jsx-arrow-brackets);
+ color: var(--color-jsx-arrow-brackets);
}
.Component:after {
white-space: nowrap;
content: '>';
- color: var(--color-tree-jsx-arrow-brackets);
+ color: var(--color-jsx-arrow-brackets);
}
.AttributeName {
diff --git a/src/devtools/views/OwnersStack.css b/src/devtools/views/OwnersStack.css
index c7b4228fe7..744d27614a 100644
--- a/src/devtools/views/OwnersStack.css
+++ b/src/devtools/views/OwnersStack.css
@@ -5,24 +5,6 @@
overflow-x: auto;
}
-.IconButton {
- border: none;
- background: none;
- display: inline-flex;
- align-items: center;
- padding: 0.25rem;
- cursor: pointer;
- color: var(--color-button);
- flex: 0 0 auto;
-}
-.IconButton:hover {
- color: var(--color-button-hover);
-}
-.IconButton:disabled {
- color: var(--color-dimmer);
- cursor: default;
-}
-
.Component,
.FocusedComponent {
padding: 0.25rem;
diff --git a/src/devtools/views/OwnersStack.js b/src/devtools/views/OwnersStack.js
index 57720a671e..502e11306e 100644
--- a/src/devtools/views/OwnersStack.js
+++ b/src/devtools/views/OwnersStack.js
@@ -1,6 +1,7 @@
// @flow
import React, { useCallback, useContext } from 'react';
+import Button from './Button';
import ButtonIcon from './ButtonIcon';
import { TreeContext } from './TreeContext';
import { StoreContext } from './context';
@@ -19,13 +20,13 @@ export default function OwnerStack() {
return (
diff --git a/src/devtools/views/SearchInput.css b/src/devtools/views/SearchInput.css
index 053e70c5cc..a4c17ae1f5 100644
--- a/src/devtools/views/SearchInput.css
+++ b/src/devtools/views/SearchInput.css
@@ -25,24 +25,6 @@
font-size: var(--font-size-sans-normal);
}
-.IconButton {
- border: none;
- background: none;
- display: inline-flex;
- align-items: center;
- padding: 0.25rem;
- cursor: pointer;
- color: var(--color-button);
- flex: 0 0 auto;
-}
-.IconButton:hover {
- color: var(--color-button-hover);
-}
-.IconButton:disabled {
- color: var(--color-dimmer);
- cursor: default;
-}
-
.LeftVRule,
.RightVRule {
height: 20px;
diff --git a/src/devtools/views/SearchInput.js b/src/devtools/views/SearchInput.js
index 43cb3165c1..8101998a15 100644
--- a/src/devtools/views/SearchInput.js
+++ b/src/devtools/views/SearchInput.js
@@ -2,6 +2,7 @@
import React, { useCallback, useContext, useEffect, useRef } from 'react';
import { TreeContext } from './TreeContext';
+import Button from './Button';
import ButtonIcon from './ButtonIcon';
import Icon from './Icon';
@@ -74,30 +75,30 @@ export default function SearchInput(props: Props) {
)}
-
-
{source !== null && (
-
-
+
)}
diff --git a/src/devtools/views/SettingsContext.js b/src/devtools/views/SettingsContext.js
index 75535650db..83a429c1b5 100644
--- a/src/devtools/views/SettingsContext.js
+++ b/src/devtools/views/SettingsContext.js
@@ -103,86 +103,42 @@ function setStyleVariable(name: string, value: string) {
(document.documentElement: any).style.setProperty(name, value);
}
+function updateStyleHelper(themeKey: string, style: string) {
+ setStyleVariable(`--${style}`, `var(--${themeKey}-${style})`);
+}
+
function updateDisplayDensity(displayDensity: DisplayDensity): void {
- setStyleVariable(
- '--font-size-monospace-normal',
- `var(--${displayDensity}-font-size-monospace-normal)`
- );
- setStyleVariable(
- '--font-size-monospace-large',
- `var(--${displayDensity}-font-size-monospace-large)`
- );
- setStyleVariable(
- '--font-size-sans-normal',
- `var(--${displayDensity}-font-size-sans-normal)`
- );
- setStyleVariable(
- '--font-size-sans-large',
- `var(--${displayDensity}-font-size-sans-large)`
- );
- setStyleVariable(
- '--line-height-data',
- `var(--${displayDensity}-line-height-data)`
- );
+ updateStyleHelper(displayDensity, 'font-size-monospace-normal');
+ updateStyleHelper(displayDensity, 'font-size-monospace-large');
+ updateStyleHelper(displayDensity, 'font-size-sans-normal');
+ updateStyleHelper(displayDensity, 'font-size-sans-large');
+ updateStyleHelper(displayDensity, 'line-height-data');
}
function updateThemeVariables(theme: Theme): void {
- setStyleVariable('--color-arrow', `var(--theme-${theme}-arrow)`);
- setStyleVariable(
- '--color-arrow-inverted',
- `var(--theme-${theme}-arrow-inverted)`
- );
- setStyleVariable(
- '--color-attribute-name',
- `var(--theme-${theme}-attribute-name)`
- );
- setStyleVariable(
- '--color-attribute-value',
- `var(--theme-${theme}-attribute-value)`
- );
- setStyleVariable('--color-background', `var(--theme-${theme}-background)`);
- setStyleVariable('--color-border', `var(--theme-${theme}-color-border)`);
- setStyleVariable('--color-button', `var(--theme-${theme}-button)`);
- setStyleVariable(
- '--color-button-hover',
- `var(--theme-${theme}-button-hover)`
- );
- setStyleVariable(
- '--color-component-name',
- `var(--theme-${theme}-component-name)`
- );
- setStyleVariable(
- '--color-component-name-inverted',
- `var(--theme-${theme}-component-name-inverted)`
- );
- setStyleVariable('--color-dim', `var(--theme-${theme}-dim)`);
- setStyleVariable('--color-dimmer', `var(--theme-${theme}-dimmer)`);
- setStyleVariable('--color-dimmest', `var(--theme-${theme}-dimmest)`);
- setStyleVariable(
- '--color-search-match',
- `var(--theme-${theme}-search-match)`
- );
- setStyleVariable(
- '--color-search-match-current',
- `var(--theme-${theme}-search-match-current)`
- );
- setStyleVariable('--color-text-color', `var(--theme-${theme}-text-color)`);
- setStyleVariable(
- '--color-tree-jsx-arrow-brackets',
- `var(--theme-${theme}-jsx-arrow-brackets)`
- );
- setStyleVariable(
- '--color-tree-jsx-arrow-brackets-inverted',
- `var(--theme-${theme}-jsx-arrow-brackets-inverted)`
- );
- setStyleVariable(
- '--color-tree-node-selected',
- `var(--theme-${theme}-tree-node-selected)`
- );
- setStyleVariable(
- '--color-tree-node-hover',
- `var(--theme-${theme}-tree-node-hover)`
- );
+ updateStyleHelper(theme, 'color-attribute-name');
+ updateStyleHelper(theme, 'color-attribute-value');
+ updateStyleHelper(theme, 'color-background');
+ updateStyleHelper(theme, 'color-border');
+ updateStyleHelper(theme, 'color-button-background');
+ updateStyleHelper(theme, 'color-button-background-focus');
+ updateStyleHelper(theme, 'color-button-background-hover');
+ updateStyleHelper(theme, 'color-button');
+ updateStyleHelper(theme, 'color-button-disabled');
+ updateStyleHelper(theme, 'color-button-focus');
+ updateStyleHelper(theme, 'color-button-hover');
+ updateStyleHelper(theme, 'color-component-name');
+ updateStyleHelper(theme, 'color-component-name-inverted');
+ updateStyleHelper(theme, 'color-dim');
+ updateStyleHelper(theme, 'color-dimmer');
+ updateStyleHelper(theme, 'color-dimmest');
+ updateStyleHelper(theme, 'color-search-match');
+ updateStyleHelper(theme, 'color-search-match-current');
+ updateStyleHelper(theme, 'color-text-color');
+ updateStyleHelper(theme, 'color-jsx-arrow-brackets');
+ updateStyleHelper(theme, 'color-jsx-arrow-brackets-inverted');
+ updateStyleHelper(theme, 'color-tree-node-selected');
+ updateStyleHelper(theme, 'color-tree-node-hover');
}
export { SettingsContext, SettingsContextController };
diff --git a/src/devtools/views/Tree.css b/src/devtools/views/Tree.css
index fab177f808..51a3c70818 100644
--- a/src/devtools/views/Tree.css
+++ b/src/devtools/views/Tree.css
@@ -26,17 +26,3 @@
font-size: var(--font-size-monospace-normal);
line-height: var(--line-height-data);
}
-
-.IconButton {
- border: none;
- background: none;
- display: inline-flex;
- align-items: center;
- padding: 0.25rem;
- cursor: pointer;
- color: var(--color-button);
- flex: 0 0 auto;
-}
-.IconButton:hover {
- color: var(--color-button-hover);
-}
diff --git a/src/devtools/views/Tree.js b/src/devtools/views/Tree.js
index 9b177bfed4..9b2064042f 100644
--- a/src/devtools/views/Tree.js
+++ b/src/devtools/views/Tree.js
@@ -11,6 +11,7 @@ import AutoSizer from 'react-virtualized-auto-sizer';
import { FixedSizeList } from 'react-window';
import { TreeContext } from './TreeContext';
import { SettingsContext } from './SettingsContext';
+import Button from './Button';
import ButtonIcon from './ButtonIcon';
import Element from './Element';
import OwnersStack from './OwnersStack';
@@ -86,12 +87,12 @@ export default function Tree(props: Props) {
{ownerStack.length > 0 ? : }
-
-
+
diff --git a/src/devtools/views/root.css b/src/devtools/views/root.css
index 5b4aa26aa2..f8ec068351 100644
--- a/src/devtools/views/root.css
+++ b/src/devtools/views/root.css
@@ -4,48 +4,54 @@
*/
/* Light theme */
- --theme-light-arrow: #777d88;
- --theme-light-arrow-inverted: #ffffff;
- --theme-light-attribute-name: #ef6632;
- --theme-light-attribute-value: #1a1aa6;
- --theme-light-background: #ffffff;
- --theme-light-button: #0088fa;
- --theme-light-button-hover: #3578e5;
- --theme-light-color-border: #eeeeee;
- --theme-light-component-name: #8155cb;
- --theme-light-component-name-inverted: #ffffff;
- --theme-light-dim: #777d88;
- --theme-light-dimmer: #cfd1d5;
- --theme-light-dimmest: #eff0f1;
- --theme-light-jsx-arrow-brackets: #333333;
- --theme-light-jsx-arrow-brackets-inverted: rgba(255, 255, 255, 0.7);
- --theme-light-search-match: yellow;
- --theme-light-search-match-current: #f7923b;
- --theme-light-text-color: #000000;
- --theme-light-tree-node-selected: #0088fa;
- --theme-light-tree-node-hover: #ebf1fb;
+ --light-color-attribute-name: #ef6632;
+ --light-color-attribute-value: #1a1aa6;
+ --light-color-background: #ffffff;
+ --light-color-button-background: #ffffff;
+ --light-color-button-background-focus: #ebf1fb;
+ --light-color-button-background-hover: #ffffff;
+ --light-color-button: #0088fa;
+ --light-color-button-disabled: #cfd1d5;
+ --light-color-button-focus: #3578e5;
+ --light-color-button-hover: #3578e5;
+ --light-color-border: #eeeeee;
+ --light-color-component-name: #8155cb;
+ --light-color-component-name-inverted: #ffffff;
+ --light-color-dim: #777d88;
+ --light-color-dimmer: #cfd1d5;
+ --light-color-dimmest: #eff0f1;
+ --light-color-jsx-arrow-brackets: #333333;
+ --light-color-jsx-arrow-brackets-inverted: rgba(255, 255, 255, 0.7);
+ --light-color-search-match: yellow;
+ --light-color-search-match-current: #f7923b;
+ --light-color-text-color: #000000;
+ --light-color-tree-node-selected: #0088fa;
+ --light-color-tree-node-hover: #ebf1fb;
/* Dark theme */
- --theme-dark-arrow: #777d88;
- --theme-dark-arrow-inverted: #282828;
- --theme-dark-attribute-name: #9d87d2;
- --theme-dark-attribute-value: #cedae0;
- --theme-dark-background: #282c34;
- --theme-dark-button: #61dafb;
- --theme-dark-button-hover: #a2e9fc;
- --theme-dark-color-border: #3d424a;
- --theme-dark-component-name: #61dafb;
- --theme-dark-component-name-inverted: ##282828;
- --theme-dark-dim: #8f949d;
- --theme-dark-dimmer: #777d88;
- --theme-dark-dimmest: #4f5766;
- --theme-dark-jsx-arrow-brackets: #777d88;
- --theme-dark-jsx-arrow-brackets-inverted: rgba(255, 255, 255, 0.7);
- --theme-dark-search-match: yellow;
- --theme-dark-search-match-current: #f7923b;
- --theme-dark-text-color: #ffffff;
- --theme-dark-tree-node-selected: #178fb9;
- --theme-dark-tree-node-hover: #3d424a;
+ --dark-color-attribute-name: #9d87d2;
+ --dark-color-attribute-value: #cedae0;
+ --dark-color-background: #282c34;
+ --dark-color-button-background: #282c34;
+ --dark-color-button-background-focus: #3d424a;
+ --dark-color-button-background-hover: #282c34;
+ --dark-color-button: #61dafb;
+ --dark-color-button-disabled: #777d88;
+ --dark-color-button-focus: #a2e9fc;
+ --dark-color-button-hover: #a2e9fc;
+ --dark-color-border: #3d424a;
+ --dark-color-component-name: #61dafb;
+ --dark-color-component-name-inverted: ##282828;
+ --dark-color-dim: #8f949d;
+ --dark-color-dimmer: #777d88;
+ --dark-color-dimmest: #4f5766;
+ --dark-color-jsx-arrow-brackets: #777d88;
+ --dark-color-jsx-arrow-brackets-inverted: rgba(255, 255, 255, 0.7);
+ --dark-color-search-match: yellow;
+ --dark-color-search-match-current: #f7923b;
+ --dark-color-text-color: #ffffff;
+ --dark-color-tree-node-selected: #178fb9;
+ --dark-color-tree-node-hover: #3d424a;
/* Compact density */
--compact-font-size-monospace-normal: 11px;