mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Removing MaterialTooltip references
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
7058193295
commit
393ff0d1d4
@ -29,7 +29,6 @@ import { SubTitle } from "../layout/sub-title";
|
|||||||
import { TooltipPosition } from "../tooltip";
|
import { TooltipPosition } from "../tooltip";
|
||||||
import { ExtensionInstallationStateStore } from "./extension-install.store";
|
import { ExtensionInstallationStateStore } from "./extension-install.store";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { MaterialTooltip } from "../material-tooltip/material-tooltip";
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
installPath: string;
|
installPath: string;
|
||||||
@ -71,13 +70,12 @@ export const Install = observer((props: Props) => {
|
|||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
onSubmit={installFromInput}
|
onSubmit={installFromInput}
|
||||||
iconRight={
|
iconRight={
|
||||||
<MaterialTooltip title="Browse">
|
<Icon
|
||||||
<Icon
|
className={styles.icon}
|
||||||
className={styles.icon}
|
material="folder_open"
|
||||||
material="folder_open"
|
onClick={prevDefault(installFromSelectFileDialog)}
|
||||||
onClick={prevDefault(installFromSelectFileDialog)}
|
tooltip="Browse"
|
||||||
/>
|
/>
|
||||||
</MaterialTooltip>
|
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -24,15 +24,17 @@ import { welcomeURL } from "../../../common/routes";
|
|||||||
import { navigate } from "../../navigation";
|
import { navigate } from "../../navigation";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import { TopBar } from "../layout/topbar";
|
import { TopBar } from "../layout/topbar";
|
||||||
import { MaterialTooltip } from "../material-tooltip/material-tooltip";
|
|
||||||
|
|
||||||
export function CatalogTopbar() {
|
export function CatalogTopbar() {
|
||||||
return (
|
return (
|
||||||
<TopBar label="Catalog">
|
<TopBar label="Catalog">
|
||||||
<div>
|
<div>
|
||||||
<MaterialTooltip title="Close Catalog" placement="left">
|
<Icon
|
||||||
<Icon style={{ cursor: "default" }} material="close" onClick={() => navigate(welcomeURL())}/>
|
style={{ cursor: "default" }}
|
||||||
</MaterialTooltip>
|
material="close"
|
||||||
|
onClick={() => navigate(welcomeURL())}
|
||||||
|
tooltip="Close Catalog"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</TopBar>
|
</TopBar>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -18,19 +18,19 @@
|
|||||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import type { RouteComponentProps } from "react-router";
|
|
||||||
|
import { previousActiveTab } from "../+catalog";
|
||||||
|
import { ClusterStore } from "../../../common/cluster-store";
|
||||||
import { catalogURL } from "../../../common/routes";
|
import { catalogURL } from "../../../common/routes";
|
||||||
import { navigate } from "../../navigation";
|
import { navigate } from "../../navigation";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import { TopBar } from "../layout/topbar";
|
import { TopBar } from "../layout/topbar";
|
||||||
import { MaterialTooltip } from "../material-tooltip/material-tooltip";
|
|
||||||
import type { Cluster } from "../../../main/cluster";
|
import type { RouteComponentProps } from "react-router";
|
||||||
import { ClusterStore } from "../../../common/cluster-store";
|
|
||||||
import type { ClusterViewRouteParams } from "../../../common/routes";
|
import type { ClusterViewRouteParams } from "../../../common/routes";
|
||||||
import { previousActiveTab } from "../+catalog";
|
import type { Cluster } from "../../../main/cluster";
|
||||||
|
|
||||||
interface Props extends RouteComponentProps<ClusterViewRouteParams> {
|
interface Props extends RouteComponentProps<ClusterViewRouteParams> {
|
||||||
}
|
}
|
||||||
@ -43,11 +43,14 @@ export const ClusterTopbar = observer((props: Props) => {
|
|||||||
return (
|
return (
|
||||||
<TopBar label={getCluster()?.name}>
|
<TopBar label={getCluster()?.name}>
|
||||||
<div>
|
<div>
|
||||||
<MaterialTooltip title="Back to Catalog" placement="left">
|
<Icon
|
||||||
<Icon style={{ cursor: "default" }} material="close" onClick={() => {
|
style={{ cursor: "default" }}
|
||||||
|
material="close"
|
||||||
|
onClick={() => {
|
||||||
navigate(`${catalogURL()}/${previousActiveTab.get()}`);
|
navigate(`${catalogURL()}/${previousActiveTab.get()}`);
|
||||||
}}/>
|
}}
|
||||||
</MaterialTooltip>
|
tooltip="Back to Catalog"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</TopBar>
|
</TopBar>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -140,6 +140,7 @@ export class HotbarEntityIcon extends React.Component<Props> {
|
|||||||
active={isActive}
|
active={isActive}
|
||||||
onMenuOpen={onOpen}
|
onMenuOpen={onOpen}
|
||||||
menuItems={this.contextMenu.menuItems}
|
menuItems={this.contextMenu.menuItems}
|
||||||
|
tooltip={`${entity.metadata.name} (${entity.metadata.source})`}
|
||||||
{...elemProps}
|
{...elemProps}
|
||||||
>
|
>
|
||||||
{ this.ledIcon }
|
{ this.ledIcon }
|
||||||
|
|||||||
@ -68,9 +68,11 @@
|
|||||||
box-shadow: 0 0 0px 3px var(--clusterMenuBackground), 0 0 0px 6px var(--textColorAccent);
|
box-shadow: 0 0 0px 3px var(--clusterMenuBackground), 0 0 0px 6px var(--textColorAccent);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&.interactive {
|
||||||
&:not(.active) {
|
&:hover {
|
||||||
box-shadow: 0 0 0px 3px var(--clusterMenuBackground), 0 0 0px 6px #ffffff50;
|
&:not(.active) {
|
||||||
|
box-shadow: 0 0 0px 3px var(--clusterMenuBackground), 0 0 0px 6px #ffffff50;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,10 +27,10 @@ import type { CatalogEntityContextMenu } from "../../../common/catalog";
|
|||||||
import { cssNames, IClassName } from "../../utils";
|
import { cssNames, IClassName } from "../../utils";
|
||||||
import { ConfirmDialog } from "../confirm-dialog";
|
import { ConfirmDialog } from "../confirm-dialog";
|
||||||
import { Menu, MenuItem } from "../menu";
|
import { Menu, MenuItem } from "../menu";
|
||||||
import { MaterialTooltip } from "../material-tooltip/material-tooltip";
|
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { Avatar } from "../avatar/avatar";
|
import { Avatar } from "../avatar/avatar";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
|
import { Tooltip } from "../tooltip";
|
||||||
|
|
||||||
export interface HotbarIconProps extends DOMAttributes<HTMLElement> {
|
export interface HotbarIconProps extends DOMAttributes<HTMLElement> {
|
||||||
uid: string;
|
uid: string;
|
||||||
@ -45,6 +45,8 @@ export interface HotbarIconProps extends DOMAttributes<HTMLElement> {
|
|||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
size?: number;
|
size?: number;
|
||||||
background?: string;
|
background?: string;
|
||||||
|
interactive?: boolean;
|
||||||
|
tooltip?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMenuItemClick(menuItem: CatalogEntityContextMenu) {
|
function onMenuItemClick(menuItem: CatalogEntityContextMenu) {
|
||||||
@ -64,7 +66,7 @@ function onMenuItemClick(menuItem: CatalogEntityContextMenu) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const HotbarIcon = observer(({menuItems = [], size = 40, ...props}: HotbarIconProps) => {
|
export const HotbarIcon = observer(({menuItems = [], size = 40, interactive = true, tooltip, ...props}: HotbarIconProps) => {
|
||||||
const { uid, title, src, material, active, className, source, disabled, onMenuOpen, onClick, children, ...rest } = props;
|
const { uid, title, src, material, active, className, source, disabled, onMenuOpen, onClick, children, ...rest } = props;
|
||||||
const id = `hotbarIcon-${uid}`;
|
const id = `hotbarIcon-${uid}`;
|
||||||
const [menuOpen, setMenuOpen] = useState(false);
|
const [menuOpen, setMenuOpen] = useState(false);
|
||||||
@ -79,7 +81,7 @@ export const HotbarIcon = observer(({menuItems = [], size = 40, ...props}: Hotba
|
|||||||
{...rest}
|
{...rest}
|
||||||
title={title}
|
title={title}
|
||||||
colorHash={`${title}-${source}`}
|
colorHash={`${title}-${source}`}
|
||||||
className={active ? "active" : "default"}
|
className={cssNames(active ? "active" : "default", { interactive })}
|
||||||
width={size}
|
width={size}
|
||||||
height={size}
|
height={size}
|
||||||
src={src}
|
src={src}
|
||||||
@ -96,12 +98,11 @@ export const HotbarIcon = observer(({menuItems = [], size = 40, ...props}: Hotba
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cssNames("HotbarIcon flex", className, { disabled })}>
|
<div className={cssNames("HotbarIcon flex", className, { disabled })}>
|
||||||
<MaterialTooltip title={`${title || "unknown"} (${source || "unknown"})`} placement="right">
|
{tooltip && <Tooltip targetId={id}>{tooltip}</Tooltip>}
|
||||||
<div id={id}>
|
<div id={id}>
|
||||||
{renderIcon()}
|
{renderIcon()}
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
</MaterialTooltip>
|
|
||||||
<Menu
|
<Menu
|
||||||
usePortal
|
usePortal
|
||||||
htmlFor={id}
|
htmlFor={id}
|
||||||
|
|||||||
@ -164,6 +164,7 @@ export class HotbarMenu extends React.Component<Props> {
|
|||||||
title={item.entity.name}
|
title={item.entity.name}
|
||||||
source={item.entity.source}
|
source={item.entity.source}
|
||||||
menuItems={disabledMenuItems}
|
menuItems={disabledMenuItems}
|
||||||
|
tooltip={`${item.entity.name} (${item.entity.source})`}
|
||||||
disabled
|
disabled
|
||||||
size={40}
|
size={40}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -27,7 +27,7 @@ import { Hotbar, HotbarStore } from "../../../common/hotbar-store";
|
|||||||
import { CommandOverlay } from "../command-palette";
|
import { CommandOverlay } from "../command-palette";
|
||||||
import { HotbarSwitchCommand } from "./hotbar-switch-command";
|
import { HotbarSwitchCommand } from "./hotbar-switch-command";
|
||||||
import { hotbarDisplayIndex } from "./hotbar-display-label";
|
import { hotbarDisplayIndex } from "./hotbar-display-label";
|
||||||
import { MaterialTooltip } from "../material-tooltip/material-tooltip";
|
import { TooltipPosition } from "../tooltip";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
hotbar: Hotbar;
|
hotbar: Hotbar;
|
||||||
@ -40,14 +40,16 @@ export function HotbarSelector({ hotbar }: Props) {
|
|||||||
<div className="HotbarSelector flex align-center">
|
<div className="HotbarSelector flex align-center">
|
||||||
<Icon material="play_arrow" className="previous box" onClick={() => store.switchToPrevious()} />
|
<Icon material="play_arrow" className="previous box" onClick={() => store.switchToPrevious()} />
|
||||||
<div className="box grow flex align-center">
|
<div className="box grow flex align-center">
|
||||||
<MaterialTooltip arrow title={hotbar.name}>
|
<Badge
|
||||||
<Badge
|
id="hotbarIndex"
|
||||||
id="hotbarIndex"
|
small
|
||||||
small
|
label={hotbarDisplayIndex(store.activeHotbarId)}
|
||||||
label={hotbarDisplayIndex(store.activeHotbarId)}
|
onClick={() => CommandOverlay.open(<HotbarSwitchCommand />)}
|
||||||
onClick={() => CommandOverlay.open(<HotbarSwitchCommand />)}
|
tooltip={{
|
||||||
/>
|
preferredPositions: [TooltipPosition.TOP, TooltipPosition.TOP_LEFT],
|
||||||
</MaterialTooltip>
|
children: hotbar.name
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Icon material="play_arrow" className="next box" onClick={() => store.switchToNext()} />
|
<Icon material="play_arrow" className="next box" onClick={() => store.switchToNext()} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
.Tooltip {
|
.Tooltip {
|
||||||
--bgc: #{$mainBackground};
|
--bgc: #{$mainBackground};
|
||||||
--radius: #{$radius};
|
--radius: #{$radius};
|
||||||
--color: #{$textColorSecondary};
|
--color: #{$textColorAccent};
|
||||||
--border: 1px solid #{$borderColor};
|
--border: 1px solid #{$borderColor};
|
||||||
|
|
||||||
// use positioning relative to viewport (window)
|
// use positioning relative to viewport (window)
|
||||||
@ -33,17 +33,18 @@
|
|||||||
background: var(--bgc);
|
background: var(--bgc);
|
||||||
font-size: small;
|
font-size: small;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
border: var(--border);
|
|
||||||
border-radius: var(--radius);
|
border-radius: var(--radius);
|
||||||
color: var(--color);
|
color: var(--color);
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
padding: .5em;
|
padding: .5em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
transition: opacity 150ms 25ms ease-in-out;
|
transition: opacity 150ms 150ms ease-in-out;
|
||||||
z-index: 100000;
|
z-index: 100000;
|
||||||
|
opacity: 1;
|
||||||
|
box-shadow: 0 8px 16px rgba(0,0,0,0.24);
|
||||||
|
|
||||||
&.hidden {
|
&.invisible {
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|||||||
@ -228,7 +228,7 @@ export class Tooltip extends React.Component<TooltipProps> {
|
|||||||
render() {
|
render() {
|
||||||
const { style, formatters, usePortal, children } = this.props;
|
const { style, formatters, usePortal, children } = this.props;
|
||||||
const className = cssNames("Tooltip", this.props.className, formatters, this.activePosition, {
|
const className = cssNames("Tooltip", this.props.className, formatters, this.activePosition, {
|
||||||
hidden: !this.isVisible,
|
invisible: !this.isVisible,
|
||||||
formatter: !!formatters,
|
formatter: !!formatters,
|
||||||
});
|
});
|
||||||
const tooltip = (
|
const tooltip = (
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user