/** * Copyright (c) OpenLens Authors. All rights reserved. * Licensed under MIT License. See LICENSE in root directory for more information. */ import styles from "./styles.module.scss"; import React, { useState } from "react"; import { Menu, MenuItem } from "../menu"; import uniqueId from "lodash/uniqueId"; import { noop } from "lodash"; import { cssNames } from "../../utils"; interface UpdateButtonProps { warningLevel?: "light" | "medium" | "high"; update: () => void; } export function UpdateButton({ warningLevel, update }: UpdateButtonProps) { const id = uniqueId("update_button_"); const [opened, setOpened] = useState(false); const onKeyDown = (evt: React.KeyboardEvent) => { if (evt.code == "Space" || evt.code == "Enter") { toggle(); } }; const toggle = () => { setOpened(!opened); }; if (!warningLevel) { return null; } return ( <> Relaunch to Update Lens ); }