|
1 |
| -import React from 'react'; |
2 |
| -import PropTypes from 'prop-types'; |
3 |
| -import classNames from 'classnames'; |
4 |
| -import {tagPropType, mapToCssModules} from './Shared/helper.js'; |
| 1 | +import React from 'react' |
| 2 | +import PropTypes from 'prop-types' |
| 3 | +import classNames from 'classnames' |
| 4 | +import { mapToCssModules } from './Shared/helper.js' |
5 | 5 |
|
6 | 6 | //component - CoreUI / CButtonClose
|
7 | 7 |
|
8 |
| -const CButtonClose = props=>{ |
| 8 | +const CButtonClose = props => { |
9 | 9 |
|
10 | 10 | const {
|
11 |
| - tag: Tag, |
12 | 11 | children,
|
13 | 12 | className,
|
14 | 13 | cssModule,
|
15 | 14 | //
|
| 15 | + buttonClass, |
16 | 16 | innerRef,
|
17 |
| - iconHtml, |
18 | 17 | ...attributes
|
19 |
| - } = props; |
| 18 | + } = props |
20 | 19 |
|
21 | 20 | //render
|
22 | 21 |
|
23 | 22 | const classes = mapToCssModules(classNames(
|
24 |
| - 'close', |
| 23 | + buttonClass, |
25 | 24 | className
|
26 |
| - ), cssModule); |
| 25 | + ), cssModule) |
27 | 26 |
|
28 | 27 | return (
|
29 |
| - <Tag {...attributes} aria-label="Close" className={classes} ref={innerRef}>{children||iconHtml}</Tag> |
30 |
| - ); |
| 28 | + <button |
| 29 | + className={classes} |
| 30 | + aria-label="Close" |
| 31 | + {...attributes} |
| 32 | + ref={innerRef} |
| 33 | + > |
| 34 | + { children || String.fromCharCode(215) } |
| 35 | + </button> |
| 36 | + ) |
31 | 37 |
|
32 | 38 | }
|
33 | 39 |
|
34 | 40 | CButtonClose.propTypes = {
|
35 |
| - tag: tagPropType, |
36 | 41 | children: PropTypes.node,
|
37 | 42 | className: PropTypes.string,
|
38 | 43 | cssModule: PropTypes.object,
|
39 | 44 | //
|
| 45 | + buttonClass: PropTypes.string, |
40 | 46 | innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
|
41 |
| - iconHtml: PropTypes.oneOfType([PropTypes.node, PropTypes.string])//object |
42 |
| -}; |
| 47 | +} |
43 | 48 |
|
44 | 49 | CButtonClose.defaultProps = {
|
45 |
| - tag: 'button', |
46 |
| - iconHtml: <React.Fragment>×</React.Fragment> |
47 |
| -}; |
| 50 | + buttonClass: 'close' |
| 51 | +} |
48 | 52 |
|
49 |
| -export default CButtonClose; |
| 53 | +export default CButtonClose |
0 commit comments