1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix use transparent bg if Avatar contains <img/> inside (#5131)

Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
Alex Andreev 2022-03-29 17:02:18 +03:00 committed by Jim Ehrismann
parent 8ebb0c4851
commit 841ae5e846
2 changed files with 7 additions and 2 deletions

View File

@ -59,6 +59,10 @@ export function Avatar(props: AvatarProps) {
const { title, variant = "rounded", size = 32, colorHash, children, background, imgProps, src, className, disabled, ...rest } = props;
const getBackgroundColor = () => {
if (src) {
return "transparent";
}
return background || randomColor({ seed: colorHash, luminosity: "dark" });
};

View File

@ -16,6 +16,7 @@ import { navigate } from "../../navigation";
import { Menu, MenuItem } from "../menu";
import { ConfirmDialog } from "../confirm-dialog";
import { Tooltip } from "../tooltip";
import { observer } from "mobx-react";
const contextMenu: CatalogEntityContextMenuContext = observable({
menuItems: [],
@ -59,7 +60,7 @@ function renderLoadingSidebarCluster() {
);
}
export function SidebarCluster({ clusterEntity }: { clusterEntity: CatalogEntity }) {
export const SidebarCluster = observer(({ clusterEntity }: { clusterEntity: CatalogEntity }) => {
const [opened, setOpened] = useState(false);
if (!clusterEntity) {
@ -138,4 +139,4 @@ export function SidebarCluster({ clusterEntity }: { clusterEntity: CatalogEntity
</Menu>
</div>
);
}
});