mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-18 21:02:00 +01:00
Widget Config Magnify (#1689)
Introduces a configuration option to widgets to allow them to magnify on startup.
This commit is contained in:
parent
5c3eba2644
commit
a3cbcc5a77
@ -45,6 +45,7 @@ This `WidgetConfigType` is shared between all types of widgets. That is to say,
|
||||
| "color" | (optional) A string representing a color as would be used in CSS. Hex codes and custom CSS properties are included. This defaults to `"var(--secondary-text-color)"` which is a color wave uses for text that should be differentiated from other text. Out of the box, it is `"#c3c8c2"`. |
|
||||
| "label" | (optional) A string representing the label that appears underneath the widget. It will also act as a tooltip on hover if the `"description"` key isn't filled out. It is null by default. |
|
||||
| "description" | (optional) A description of what the widget does. If it is specified, this serves as a tooltip on hover. It is null by default. |
|
||||
| "magnified" | (optional) A boolean indicating whether or not the widget should launch magnfied. It is false by default. |
|
||||
| "blockdef" | This is where the the non-visual portion of the widget is defined. Note that all further definition takes place inside a meta object inside this one. |
|
||||
|
||||
<a name="font-awesome-icons" />
|
||||
|
@ -71,17 +71,14 @@ const Widgets = memo(() => {
|
||||
);
|
||||
});
|
||||
|
||||
async function handleWidgetSelect(blockDef: BlockDef) {
|
||||
createBlock(blockDef);
|
||||
async function handleWidgetSelect(widget: WidgetConfigType) {
|
||||
const blockDef = widget.blockdef;
|
||||
createBlock(blockDef, widget.magnified);
|
||||
}
|
||||
|
||||
const Widget = memo(({ widget }: { widget: WidgetConfigType }) => {
|
||||
return (
|
||||
<div
|
||||
className="widget"
|
||||
onClick={() => handleWidgetSelect(widget.blockdef)}
|
||||
title={widget.description || widget.label}
|
||||
>
|
||||
<div className="widget" onClick={() => handleWidgetSelect(widget)} title={widget.description || widget.label}>
|
||||
<div className="widget-icon" style={{ color: widget.color }}>
|
||||
<i className={makeIconClass(widget.icon, true, { defaultIcon: "browser" })}></i>
|
||||
</div>
|
||||
|
1
frontend/types/gotypes.d.ts
vendored
1
frontend/types/gotypes.d.ts
vendored
@ -1159,6 +1159,7 @@ declare global {
|
||||
color?: string;
|
||||
label?: string;
|
||||
description?: string;
|
||||
magnified?: boolean;
|
||||
blockdef: BlockDef;
|
||||
};
|
||||
|
||||
|
@ -539,6 +539,7 @@ type WidgetConfigType struct {
|
||||
Color string `json:"color,omitempty"`
|
||||
Label string `json:"label,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Magnified bool `json:"magnified,omitempty"`
|
||||
BlockDef waveobj.BlockDef `json:"blockdef"`
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user