Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

refactor toolbutton.tsx - add default props (#1492)

Aakansha Doshi0c2aa951d6a1
diff --git a/src/components/ToolButton.tsx b/src/components/ToolButton.tsx
index 98d29e3770..b464832003 100644
--- a/src/components/ToolButton.tsx
+++ b/src/components/ToolButton.tsx
@@ -49,8 +49,8 @@ export const ToolButton = React.forwardRef(function (
<button
className={`ToolIcon_type_button ToolIcon ${sizeCn}${
props.selected ? " ToolIcon--selected" : ""
- } ${props.className || ""} ${
- props.visible || props.visible == null
+ } ${props.className} ${
+ props.visible
? "ToolIcon_type_button--show"
: "ToolIcon_type_button--hide"
}`}
@@ -94,3 +94,8 @@ export const ToolButton = React.forwardRef(function (
</label>
);
});
+
+ToolButton.defaultProps = {
+ visible: true,
+ className: "",
+};