mirror of
https://github.com/Kong/insomnia
synced 2024-11-12 17:26:32 +00:00
25 lines
639 B
TypeScript
25 lines
639 B
TypeScript
import React, { ButtonHTMLAttributes, PureComponent, ReactNode } from 'react';
|
|
|
|
interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
children: ReactNode;
|
|
noWrap?: boolean;
|
|
className?: string;
|
|
}
|
|
|
|
// eslint-disable-next-line react/prefer-stateless-function -- Dropdown's implementation makes changing this to a function component tricky.
|
|
export class DropdownButton extends PureComponent<Props> {
|
|
render() {
|
|
const { children, noWrap, ...props } = this.props;
|
|
|
|
if (noWrap) {
|
|
return <>{children}</>;
|
|
}
|
|
|
|
return (
|
|
<button type="button" {...props}>
|
|
{children}
|
|
</button>
|
|
);
|
|
}
|
|
}
|