mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
2e91ee843c
Less hasn't received an update in over a year and the parser is missing some modern syntax like relative colors so this switches us to scss
26 lines
972 B
TypeScript
26 lines
972 B
TypeScript
import clsx from "clsx";
|
|
import { memo, useState } from "react";
|
|
import { Button } from "./button";
|
|
import { FlyoutMenu } from "./flyoutmenu";
|
|
import "./menubutton.scss";
|
|
|
|
const MenuButtonComponent = ({ items, className, text, title }: MenuButtonProps) => {
|
|
const [isOpen, setIsOpen] = useState(false);
|
|
return (
|
|
<div className={clsx("menubutton", className)}>
|
|
<FlyoutMenu items={items} onOpenChange={setIsOpen}>
|
|
<Button
|
|
className="grey border-radius-3 vertical-padding-2 horizontal-padding-2"
|
|
style={{ borderColor: isOpen ? "var(--accent-color)" : "transparent" }}
|
|
title={title}
|
|
>
|
|
<div>{text}</div>
|
|
<i className="fa-sharp fa-solid fa-angle-down"></i>
|
|
</Button>
|
|
</FlyoutMenu>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export const MenuButton = memo(MenuButtonComponent) as typeof MenuButtonComponent;
|