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

This commit is contained in:
Aakansha Doshi 2020-04-29 20:43:29 +05:30 committed by GitHub
parent 4369d88898
commit 0c2aa951d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,8 +49,8 @@ export const ToolButton = React.forwardRef(function (
<button <button
className={`ToolIcon_type_button ToolIcon ${sizeCn}${ className={`ToolIcon_type_button ToolIcon ${sizeCn}${
props.selected ? " ToolIcon--selected" : "" props.selected ? " ToolIcon--selected" : ""
} ${props.className || ""} ${ } ${props.className} ${
props.visible || props.visible == null props.visible
? "ToolIcon_type_button--show" ? "ToolIcon_type_button--show"
: "ToolIcon_type_button--hide" : "ToolIcon_type_button--hide"
}`} }`}
@ -94,3 +94,8 @@ export const ToolButton = React.forwardRef(function (
</label> </label>
); );
}); });
ToolButton.defaultProps = {
visible: true,
className: "",
};