mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Keeping Icon focus state only for keyboard (#1234)
* Passing toolbar prop into action menus Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Toggling .mouse-intent Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Icon focus restyling Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Adding what-input dependency Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
14e83a4b2a
commit
b2f3cdd0d2
@ -392,6 +392,7 @@
|
|||||||
"webpack-cli": "^3.3.11",
|
"webpack-cli": "^3.3.11",
|
||||||
"webpack-dev-server": "^3.11.0",
|
"webpack-dev-server": "^3.11.0",
|
||||||
"webpack-node-externals": "^1.7.2",
|
"webpack-node-externals": "^1.7.2",
|
||||||
|
"what-input": "^5.2.10",
|
||||||
"xterm": "^4.6.0",
|
"xterm": "^4.6.0",
|
||||||
"xterm-addon-fit": "^0.4.0"
|
"xterm-addon-fit": "^0.4.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,7 +38,8 @@ import { webFrame } from "electron";
|
|||||||
import { clusterPageRegistry } from "../../extensions/registries/page-registry";
|
import { clusterPageRegistry } from "../../extensions/registries/page-registry";
|
||||||
import { DynamicPage } from "../../extensions/dynamic-page";
|
import { DynamicPage } from "../../extensions/dynamic-page";
|
||||||
import { extensionLoader } from "../../extensions/extension-loader";
|
import { extensionLoader } from "../../extensions/extension-loader";
|
||||||
import { appEventBus } from "../../common/event-bus"
|
import { appEventBus } from "../../common/event-bus";
|
||||||
|
import whatInput from 'what-input';
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class App extends React.Component {
|
export class App extends React.Component {
|
||||||
@ -57,6 +58,7 @@ export class App extends React.Component {
|
|||||||
window.addEventListener("online", () => {
|
window.addEventListener("online", () => {
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
})
|
})
|
||||||
|
whatInput.ask() // Start to monitor user input device
|
||||||
}
|
}
|
||||||
|
|
||||||
get startURL() {
|
get startURL() {
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
--size: 50%;
|
--size: 50%;
|
||||||
--full-size: 75%;
|
--full-size: 75%;
|
||||||
--spacing: #{$padding * 3};
|
--spacing: #{$padding * 3};
|
||||||
|
--icon-focus-color: white;
|
||||||
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background: $contentColor;
|
background: $contentColor;
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
--big-size: 32px;
|
--big-size: 32px;
|
||||||
--color-active: #{$iconActiveColor};
|
--color-active: #{$iconActiveColor};
|
||||||
--bgc-active: #{$iconActiveBackground};
|
--bgc-active: #{$iconActiveBackground};
|
||||||
|
--focus-color: var(--icon-focus-color, #{$lensBlue});
|
||||||
|
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
@ -106,7 +107,7 @@
|
|||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
color: var(--color-active);
|
color: var(--color-active);
|
||||||
box-shadow: 0 0 0 3px $iconActiveBackground;
|
box-shadow: 0 0 0 2px $iconActiveBackground;
|
||||||
background-color: $iconActiveBackground;
|
background-color: $iconActiveBackground;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,8 +116,16 @@
|
|||||||
transition: 250ms color, 250ms opacity, 150ms background-color, 150ms box-shadow;
|
transition: 250ms color, 250ms opacity, 150ms background-color, 150ms box-shadow;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
|
||||||
&.focusable:focus {
|
&.focusable:focus:not(:hover) {
|
||||||
@extend .active;
|
box-shadow: 0 0 0 2px var(--focus-color);
|
||||||
|
|
||||||
|
[data-whatintent='mouse'] & {
|
||||||
|
box-shadow: none;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
box-shadow: 0 0 0 2px $iconActiveBackground;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
|||||||
@ -57,11 +57,11 @@ export class KubeObjectMenu extends React.Component<KubeObjectMenuProps> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { remove, update, renderRemoveMessage, isEditable, isRemovable } = this;
|
const { remove, update, renderRemoveMessage, isEditable, isRemovable } = this;
|
||||||
const { className, object, editable, removable, ...menuProps } = this.props;
|
const { className, object, editable, removable, toolbar, ...menuProps } = this.props;
|
||||||
if (!object) return null;
|
if (!object) return null;
|
||||||
|
|
||||||
const menuItems = kubeObjectMenuRegistry.getItemsForKind(object.kind, object.apiVersion).map((item, index) => {
|
const menuItems = kubeObjectMenuRegistry.getItemsForKind(object.kind, object.apiVersion).map((item, index) => {
|
||||||
return <item.components.MenuItem object={object} key={`menu-item-${index}`} />
|
return <item.components.MenuItem object={object} key={`menu-item-${index}`} toolbar={toolbar} />
|
||||||
})
|
})
|
||||||
return (
|
return (
|
||||||
<MenuActions
|
<MenuActions
|
||||||
@ -69,6 +69,7 @@ export class KubeObjectMenu extends React.Component<KubeObjectMenuProps> {
|
|||||||
updateAction={isEditable ? update : undefined}
|
updateAction={isEditable ? update : undefined}
|
||||||
removeAction={isRemovable ? remove : undefined}
|
removeAction={isRemovable ? remove : undefined}
|
||||||
removeConfirmationMessage={renderRemoveMessage}
|
removeConfirmationMessage={renderRemoveMessage}
|
||||||
|
toolbar={toolbar}
|
||||||
{...menuProps}
|
{...menuProps}
|
||||||
>
|
>
|
||||||
{menuItems}
|
{menuItems}
|
||||||
|
|||||||
@ -38,6 +38,7 @@ export class MainLayout extends React.Component<MainLayoutProps> {
|
|||||||
(sidebarWidth) => this.storage.merge({ sidebarWidth })
|
(sidebarWidth) => this.storage.merge({ sidebarWidth })
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
toggleSidebar = () => {
|
toggleSidebar = () => {
|
||||||
this.isPinned = !this.isPinned;
|
this.isPinned = !this.isPinned;
|
||||||
this.isAccessible = false;
|
this.isAccessible = false;
|
||||||
|
|||||||
@ -14850,6 +14850,11 @@ wgxpath@~1.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/wgxpath/-/wgxpath-1.0.0.tgz#eef8a4b9d558cc495ad3a9a2b751597ecd9af690"
|
resolved "https://registry.yarnpkg.com/wgxpath/-/wgxpath-1.0.0.tgz#eef8a4b9d558cc495ad3a9a2b751597ecd9af690"
|
||||||
integrity sha1-7vikudVYzEla06mit1FZfs2a9pA=
|
integrity sha1-7vikudVYzEla06mit1FZfs2a9pA=
|
||||||
|
|
||||||
|
what-input@^5.2.10:
|
||||||
|
version "5.2.10"
|
||||||
|
resolved "https://registry.yarnpkg.com/what-input/-/what-input-5.2.10.tgz#f79f5b65cf95d75e55e6d580bb0a6b98174cad4e"
|
||||||
|
integrity sha512-7AQoIMGq7uU8esmKniOtZG3A+pzlwgeyFpkS3f/yzRbxknSL68tvn5gjE6bZ4OMFxCPjpaBd2udUTqlZ0HwrXQ==
|
||||||
|
|
||||||
whatwg-encoding@^1.0.5:
|
whatwg-encoding@^1.0.5:
|
||||||
version "1.0.5"
|
version "1.0.5"
|
||||||
resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0"
|
resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user