Skip to content

Commit 48c5b37

Browse files
committed
completed radio button group
1 parent 9e701a9 commit 48c5b37

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed

src/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ import React from 'react';
1616
import ReactDOM from 'react-dom';
1717

1818
import RadioButtonGroup from './radioButtonGroup';
19+
import theme from './theme.scss';
1920

2021
const options = [{ label: 'Alpha' }, { label: 'Beta' }, { label: 'Zheta' }]
2122
const RadioDisplay = () => (
2223
<div>
2324
<RadioButtonGroup
25+
theme={theme}
2426
options={options}
27+
inline
2528
/>
2629
</div>
2730
);

src/radioButtonGroup/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import Checkbox from '../checkbox';
55

66
import styles from './theme.scss';
77

8-
class CheckboxGroup extends React.Component {
8+
class RadioButtonGroup extends React.Component {
99
constructor(props) {
1010
super(props);
1111

1212
this.state = {
1313
currentlyActive: '',
14-
}
14+
};
1515
}
1616

1717
handleCheckListChange = (currentlyActive) => {
@@ -34,7 +34,7 @@ class CheckboxGroup extends React.Component {
3434
<div className={classNames}>
3535
<div className={cx(styles['each-check'], { inline })} onClick={() => { this.handleCheckListChange(option.label)}}>
3636
<label className={cx(styles['customized-radio'], theme['customized-radio'])}>
37-
<label className={cx('inner', { active: (option.label === this.state.currentlyActive) ? 'active' : '' })}>
37+
<label className={cx('inner', { checked: (option.label === this.state.currentlyActive) ? 'active' : '' })}>
3838
<input type="radio" />
3939
</label>
4040
</label>
@@ -49,15 +49,15 @@ class CheckboxGroup extends React.Component {
4949
}
5050
}
5151

52-
CheckboxGroup.propTypes = {
52+
RadioButtonGroup.propTypes = {
5353
options: PropTypes.array.isRequired,
5454
inline: PropTypes.bool,
5555
theme: PropTypes.string,
5656
};
5757

58-
CheckboxGroup.defaultProps = {
58+
RadioButtonGroup.defaultProps = {
5959
inline: false,
6060
theme: '',
6161
};
6262

63-
export default CheckboxGroup;
63+
export default RadioButtonGroup;

src/radioButtonGroup/theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
padding: 3px;
3030
.inner {
3131
border-radius: 50%;
32-
&.active {
32+
&.checked {
3333
background: $secondary-blue;
3434
}
3535
}

src/theme.scss

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +0,0 @@
1-
$secondary-grey: #d2d2d2;
2-
$secondary-blue: blue;
3-
$original-white: #ffffff;
4-
5-
6-
@import './toggle/theme.scss';
7-

0 commit comments

Comments
 (0)