Remove custom <Icon /> component

- Move to using Material-UI's <Icon /> and <SvgIcon />

- Move to using Material-UI's <Tooltip />

- Move to using Material-UI's <IconButton />

- Switch *.svg webpack importer so we can import then as React
  components

- Export the above to the extension API

- Move to using the Material-UI's component names for menuItem.icon's.
  This means that they are now in PascalCase instead of snake_case

- Remove the Material-UI font

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2021-04-15 16:23:52 -04:00
1 parent 8b9f645a80
commit 17291a1709
65 files changed
+5821 -322

No files matched your search

+13 -7
View File
@@ -3,6 +3,8 @@
import React from "react";
import { Component, K8sApi, Util, Navigation } from "@k8slens/extensions";
const { MuiCore: { Tooltip, SvgIcon }, Svgs, MaybeInteractive, MenuItem, SubMenu } = Component;
export interface PodShellMenuProps extends Component.KubeObjectMenuProps<K8sApi.Pod> {
}
@@ -40,29 +42,33 @@ export class PodShellMenu extends React.Component<PodShellMenuProps> {
if (!containers.length) return null;
return (
<Component.MenuItem onClick={Util.prevDefault(() => this.execShell(containers[0].name))}>
<Component.Icon svg="ssh" interactive={toolbar} title="Pod shell"/>
<MenuItem onClick={Util.prevDefault(() => this.execShell(containers[0].name))}>
<Tooltip title="Pod shell">
<MaybeInteractive isInteractive={toolbar}>
<SvgIcon component={Svgs.Ssh}/>
</MaybeInteractive>
</Tooltip>
<span className="title">Shell</span>
{containers.length > 1 && (
<>
<Component.Icon className="arrow" material="keyboard_arrow_right"/>
<Component.SubMenu>
<SubMenu>
{
containers.map(container => {
const { name } = container;
return (
<Component.MenuItem key={name} onClick={Util.prevDefault(() => this.execShell(name))} className="flex align-center">
<MenuItem key={name} onClick={Util.prevDefault(() => this.execShell(name))} className="flex align-center">
<Component.StatusBrick/>
<span>{name}</span>
</Component.MenuItem>
</MenuItem>
);
})
}
</Component.SubMenu>
</SubMenu>
</>
)}
</Component.MenuItem>
</MenuItem>
);
}
}