Decoding Grida's Toolbar_value_to_cursormode Function
In Grida source code, `toolbar_value_to_cursormode` function converts toolbar value to cursor mode using switch-case. It returns an object with type and node/tool properties based on the input value.
In this article, we will review a function named toolbar_value_to_cursormode in Grida source code.
This function is called in another function setCursorMode
<ToolsGroup
value={value}
options={[
{ value: "cursor", label: "Cursor", shortcut: "V" },
{ value: "hand", label: "Hand tool", shortcut: "H" },
]}
onValueChange={(v) => {
setCursorMode(toolbar_value_to_cursormode(v as ToolbarToolType));
}}
/>
setCursorMode is used in a component called PlaygroundToolbar.
toolbar_value_cursormode
This function is defined in forms/grida-react-canvas/...