|
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 / CButtonToolbar
|
7 | 7 |
|
8 | 8 | const CButtonToolbar = props=>{
|
9 | 9 |
|
10 | 10 | const {
|
11 |
| - tag: Tag, |
12 | 11 | className,
|
13 | 12 | cssModule,
|
14 | 13 | //
|
15 | 14 | innerRef,
|
16 | 15 | justify,
|
17 | 16 | ...attributes
|
18 |
| - } = props; |
| 17 | + } = props |
19 | 18 |
|
20 | 19 | //render
|
21 | 20 |
|
22 | 21 | const classes = mapToCssModules(classNames(
|
23 | 22 | className,
|
24 |
| - justify ? 'justify-content-between' : false, |
25 |
| - 'btn-toolbar' |
26 |
| - ), cssModule); |
| 23 | + 'btn-toolbar', |
| 24 | + { [`justify-content-${justify}`]: justify } |
| 25 | + ), cssModule) |
27 | 26 |
|
28 | 27 | return (
|
29 |
| - <Tag {...attributes} className={classes} ref={innerRef} /> |
30 |
| - ); |
| 28 | + <div |
| 29 | + className={classes} |
| 30 | + role="toolbar" |
| 31 | + aria-label="toolbar" |
| 32 | + {...attributes} |
| 33 | + ref={innerRef} |
| 34 | + /> |
| 35 | + ) |
31 | 36 |
|
32 | 37 | }
|
33 | 38 |
|
34 | 39 | CButtonToolbar.propTypes = {
|
35 |
| - tag: tagPropType, |
36 | 40 | className: PropTypes.string,
|
37 | 41 | cssModule: PropTypes.object,
|
38 | 42 | //
|
39 | 43 | innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
|
40 | 44 | role: PropTypes.string,
|
41 |
| - justify: PropTypes.bool, |
42 |
| - 'aria-label': PropTypes.string, |
43 |
| -}; |
44 |
| - |
45 |
| -CButtonToolbar.defaultProps = { |
46 |
| - tag: 'div', |
47 |
| - role: 'toolbar', |
48 |
| -}; |
| 45 | + justify: PropTypes.oneOf(['', 'start', 'end', 'between', 'center']) |
| 46 | +} |
49 | 47 |
|
50 |
| -export default CButtonToolbar; |
| 48 | +export default CButtonToolbar |
0 commit comments