mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
72f36a9639
implements `wsh run` command. lots of fixes (and new options) for command blocks. cleans up the UX/UI for command blocks. lots of bug fixes for blockcontrollers. other minor bug fixes. also makes editor:* vars into settings override atoms.
28 lines
1008 B
TypeScript
28 lines
1008 B
TypeScript
// Copyright 2023, Command Line Inc.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import { useLongClick } from "@/app/hook/useLongClick";
|
|
import { makeIconClass } from "@/util/util";
|
|
import clsx from "clsx";
|
|
import { memo, useRef } from "react";
|
|
import "./iconbutton.scss";
|
|
|
|
export const IconButton = memo(({ decl, className }: { decl: IconButtonDecl; className?: string }) => {
|
|
const buttonRef = useRef<HTMLDivElement>(null);
|
|
const spin = decl.iconSpin ?? false;
|
|
useLongClick(buttonRef, decl.click, decl.longClick, decl.disabled);
|
|
return (
|
|
<div
|
|
ref={buttonRef}
|
|
className={clsx("iconbutton", className, decl.className, {
|
|
disabled: decl.disabled,
|
|
"no-action": decl.noAction,
|
|
})}
|
|
title={decl.title}
|
|
style={{ color: decl.iconColor ?? "inherit" }}
|
|
>
|
|
{typeof decl.icon === "string" ? <i className={makeIconClass(decl.icon, true, { spin })} /> : decl.icon}
|
|
</div>
|
|
);
|
|
});
|