mirror of https://github.com/grafana/grafana
parent
6d5f5b644b
commit
f5966b44af
@ -1,49 +0,0 @@ |
||||
import React, { PureComponent } from 'react'; |
||||
import _ from 'lodash'; |
||||
|
||||
export interface Props { |
||||
label: string; |
||||
checked: boolean; |
||||
labelClass?: string; |
||||
switchClass?: string; |
||||
onChange: (event) => any; |
||||
} |
||||
|
||||
export interface State { |
||||
id: any; |
||||
} |
||||
|
||||
export class FormSwitch extends PureComponent<Props, State> { |
||||
state = { |
||||
id: _.uniqueId(), |
||||
}; |
||||
|
||||
internalOnChange = event => { |
||||
event.stopPropagation(); |
||||
|
||||
this.props.onChange(event); |
||||
}; |
||||
|
||||
render() { |
||||
const { labelClass, switchClass, label, checked } = this.props; |
||||
const labelId = `check-${this.state.id}`; |
||||
const labelClassName = `gf-form-label ${labelClass} pointer`; |
||||
const switchClassName = `gf-form-switch ${switchClass}`; |
||||
|
||||
return ( |
||||
<div className="gf-form"> |
||||
{label && ( |
||||
<label htmlFor={labelId} className={labelClassName}> |
||||
{label} |
||||
</label> |
||||
)} |
||||
<div className={switchClassName}> |
||||
<input id={labelId} type="checkbox" checked={checked} onChange={this.internalOnChange} /> |
||||
<label htmlFor={labelId} /> |
||||
</div> |
||||
</div> |
||||
); |
||||
} |
||||
} |
||||
|
||||
export default FormSwitch; |
@ -1,7 +0,0 @@ |
||||
import React, { SFC } from 'react'; |
||||
interface Props {} |
||||
const InfoPopover: SFC<Props> = props => { |
||||
return <div />; |
||||
}; |
||||
|
||||
export default InfoPopover; |
Loading…
Reference in new issue