1 | import React from 'react';
|
2 | import PropTypes from 'prop-types';
|
3 | import classNames from 'classnames';
|
4 | import { mapToCssModules } from './utils';
|
5 |
|
6 | const propTypes = {
|
7 |
|
8 | active: PropTypes.bool,
|
9 |
|
10 | 'aria-label': PropTypes.string,
|
11 |
|
12 | onClick: PropTypes.func,
|
13 |
|
14 | variant: PropTypes.oneOf(['white']),
|
15 | className: PropTypes.string,
|
16 | cssModule: PropTypes.object,
|
17 | innerRef: PropTypes.oneOfType([
|
18 | PropTypes.object,
|
19 | PropTypes.string,
|
20 | PropTypes.func,
|
21 | ]),
|
22 | };
|
23 |
|
24 | function CloseButton(props) {
|
25 | const { className, cssModule, variant, innerRef, ...attributes } = props;
|
26 |
|
27 | const classes = mapToCssModules(
|
28 | classNames(className, 'btn-close', variant && `btn-close-${variant}`),
|
29 | );
|
30 |
|
31 | return (
|
32 | <button
|
33 | ref={innerRef}
|
34 | type="button"
|
35 | className={classes}
|
36 | {...{ 'aria-label': 'close', ...attributes }}
|
37 | />
|
38 | );
|
39 | }
|
40 |
|
41 | CloseButton.propTypes = propTypes;
|
42 |
|
43 | export default CloseButton;
|