Files
react/packages/react-devtools-shared/src/devtools/views/Button.js

47 lines
897 B
JavaScript
Raw Normal View History

2019-08-27 10:54:01 -07:00
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
2019-02-14 13:20:24 -08:00
import * as React from 'react';
2019-02-14 13:20:24 -08:00
import styles from './Button.css';
import Tooltip from './Components/reach-ui/tooltip';
2019-02-14 13:20:24 -08:00
type Props = {
children: React$Node,
2019-02-14 13:20:24 -08:00
className?: string,
testName?: ?string,
title: React$Node,
...
2019-02-14 13:20:24 -08:00
};
export default function Button({
children,
className = '',
testName,
title,
...rest
}: Props) {
2019-04-20 14:20:48 -07:00
let button = (
<button
className={`${styles.Button} ${className}`}
data-testname={testName}
{...rest}>
<span className={`${styles.ButtonContent} ${className}`} tabIndex={-1}>
{children}
</span>
</button>
2019-04-20 14:20:48 -07:00
);
if (title) {
button = <Tooltip label={title}>{button}</Tooltip>;
2019-04-20 14:20:48 -07:00
}
return button;
2019-02-14 13:20:24 -08:00
}