SessionRadio
parent
cc3e206504
commit
b97c9ec8e4
@ -0,0 +1,42 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
label: string;
|
||||||
|
active: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface State {
|
||||||
|
active: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SessionRadio extends React.PureComponent<Props, State> {
|
||||||
|
constructor(props: any) {
|
||||||
|
super(props);
|
||||||
|
this.clickHandler = this.clickHandler.bind(this);
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
active: this.props.active,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public render() {
|
||||||
|
const active = this.state.active;
|
||||||
|
const { label } = this.props;
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={classNames('session-radio', active && 'checked')}>
|
||||||
|
<input type="radio" />
|
||||||
|
<label>{ label } </label>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private clickHandler() {
|
||||||
|
this.setState({
|
||||||
|
active: !this.state.active,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
activeItem: Number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface State {
|
||||||
|
activeItem: Number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SessionRadioGroup extends React.PureComponent<Props, State> {
|
||||||
|
public static defaultProps = {
|
||||||
|
onClick: () => null,
|
||||||
|
};
|
||||||
|
|
||||||
|
constructor(props: any) {
|
||||||
|
super(props);
|
||||||
|
this.clickHandler = this.clickHandler.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public render() {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className='session-radio-group'
|
||||||
|
onClick={this.clickHandler}
|
||||||
|
>
|
||||||
|
<label className="radio-container">Four
|
||||||
|
<input type="checkbox"/>>
|
||||||
|
<span className="radio-checkmark"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private clickHandler(e: any) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue