This repository was archived by the owner on Mar 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathbutton-group.js
More file actions
42 lines (38 loc) · 1.33 KB
/
button-group.js
File metadata and controls
42 lines (38 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import React from 'react';
import PropTypes from 'prop-types';
import { Breakpoints, ButtonGroupColors, ButtonGroupSizes } from '../enums';
import { GeneralPropTypes, FlexboxPropTypes, createClassName, generalClassNames, removeProps, objectKeys, objectValues } from '../utils';
/**
* Button group component.
* http://foundation.zurb.com/sites/docs/button-group.html
*
* @param {Object} props
* @returns {Object}
*/
export const ButtonGroup = (props) => {
const className = createClassName(
props.noDefaultClassName ? null : 'button-group',
props.className,
props.color,
props.size,
{
'expanded': props.isExpanded,
'stacked-for-small': props.stackFor === Breakpoints.SMALL,
'stacked-for-medium': props.stackFor === Breakpoints.MEDIUM,
'stacked-for-large': props.stackFor === Breakpoints.LARGE,
'stacked': props.isStacked
},
generalClassNames(props)
);
const passProps = removeProps(props, objectKeys(ButtonGroup.propTypes));
return <div {...passProps} className={className}/>;
};
ButtonGroup.propTypes = {
...GeneralPropTypes,
...FlexboxPropTypes,
color: PropTypes.oneOf(objectValues(ButtonGroupColors)),
size: PropTypes.oneOf(objectValues(ButtonGroupSizes)),
stackFor: PropTypes.oneOf(objectValues(Breakpoints)),
isExpanded: PropTypes.bool,
isStacked: PropTypes.bool
};