mirror of
https://github.com/desktop/desktop
synced 2024-10-28 19:20:01 +00:00
Add reference
to Button
This commit is contained in:
parent
2bad2f17ac
commit
607e13cffd
1 changed files with 11 additions and 1 deletions
|
@ -16,6 +16,15 @@ interface IButtonProps {
|
|||
|
||||
/** CSS class names */
|
||||
readonly className?: string
|
||||
|
||||
/**
|
||||
* The `ref` for the underlying <button> element.
|
||||
*
|
||||
* Ideally this would be named `ref`, but TypeScript seems to special-case its
|
||||
* handling of the `ref` type into some ungodly monstrosity. Hopefully someday
|
||||
* this will be unnecessary.
|
||||
*/
|
||||
readonly reference?: React.Ref<HTMLButtonElement>
|
||||
}
|
||||
|
||||
/** A button component. */
|
||||
|
@ -28,7 +37,8 @@ export class Button extends React.Component<IButtonProps, void> {
|
|||
className={className}
|
||||
disabled={this.props.disabled}
|
||||
onClick={this.onClick}
|
||||
type={this.props.type}>
|
||||
type={this.props.type}
|
||||
ref={this.props.reference}>
|
||||
{this.props.children}
|
||||
</button>
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue