| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- // @flow
-
- import { makeStyles } from '@material-ui/styles';
- import React from 'react';
-
- type Props = {
-
- /**
- * Label used for accessibility.
- */
- accessibilityLabel: string,
-
- /**
- * Additional class name for custom styles.
- */
- className: string,
-
- /**
- * Children of the component.
- */
- children: string | React$Node,
-
- /**
- * Click handler.
- */
- onClick: Function,
-
- /**
- * Data test id.
- */
- testId?: string
- }
-
- const useStyles = makeStyles(theme => {
- return {
- button: {
- backgroundColor: theme.palette.action01,
- color: theme.palette.text01,
- borderRadius: `${theme.shape.borderRadius}px`,
- ...theme.typography.labelBold,
- lineHeight: `${theme.typography.labelBold.lineHeight}px`,
- padding: '8px 12px',
- display: 'flex',
- justifyContent: 'center',
- alignItems: 'center',
- border: 0,
-
- '&:hover': {
- backgroundColor: theme.palette.action01Hover
- }
- }
- };
- });
-
- const QuickActionButton = ({ accessibilityLabel, className, children, onClick, testId }: Props) => {
- const styles = useStyles();
-
- return (<button
- aria-label = { accessibilityLabel }
- className = { `${styles.button} ${className}` }
- data-testid = { testId }
- onClick = { onClick }>
- {children}
- </button>);
- };
-
- export default QuickActionButton;
|