Skip to content

Commit

Permalink
refactor: convert ToolbarButton to typescript (#4440)
Browse files Browse the repository at this point in the history
* refactor: convert ToolbarButton to typescript

* docs: update url

* chore: format
  • Loading branch information
matassp authored Feb 27, 2024
1 parent b42dcb9 commit 2ddf0a4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Contributing

IBMers should complete steps documented on
[W3 Developer](https://w3.ibm.com/developer/docs/open-source/contributing/)
[W3 Developer](https://w3.ibm.com/developer/docs/open-source/oss-contributing/)
before contributing to open source projects.

Also refer to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corp. 2021, 2021
* Copyright IBM Corp. 2021, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
Expand All @@ -16,10 +16,28 @@ import { blockClass as toolbarClass, ToolbarContext } from './Toolbar';

export const blockClass = `${toolbarClass}__button`;

interface ToolbarButtonProps extends React.ComponentProps<typeof IconButton> {
/** Determines whether the caret is rendered */
caret?: boolean;
/** Provide an optional class to be applied to the containing node */
className?: string;
/** Specifies the label for the icon button */
iconDescription: string;
/** Specifies the icon to be used by the ToolbarButton component */
renderIcon: React.ElementType;
}

/** Toolbar buttons are common functions performed as part of a products interface or an open window. */
export let ToolbarButton = forwardRef(
(
{ caret, children, className, renderIcon, iconDescription = '', ...rest },
{
caret = false,
children,
className,
renderIcon,
iconDescription = '',
...rest
}: React.PropsWithChildren<ToolbarButtonProps>,
ref
) => {
const Icon = renderIcon;
Expand Down

0 comments on commit 2ddf0a4

Please sign in to comment.