Commit e01c196d by Torkel Ödegaard

fix to switch component

parent 5f800168
......@@ -5,7 +5,6 @@ export interface Props {
label: string;
checked: boolean;
labelClass?: string;
small?: boolean;
switchClass?: string;
onChange: (event) => any;
}
......@@ -25,19 +24,15 @@ export class Switch extends PureComponent<Props, State> {
};
render() {
const { labelClass = '', switchClass = '', label, checked, small } = this.props;
const { labelClass = '', switchClass = '', label, checked } = this.props;
const labelId = `check-${this.state.id}`;
let labelClassName = `gf-form-label ${labelClass} pointer`;
let switchClassName = `gf-form-switch ${switchClass}`;
if (small) {
labelClassName += ' gf-form-label--small';
switchClassName += ' gf-form-switch--small';
}
const labelClassName = `gf-form-label ${labelClass} pointer`;
const switchClassName = `gf-form-switch ${switchClass}`;
return (
<label htmlFor={labelId} className="gf-form-switch-container">
{label && <label className={labelClassName}>{label}</label>}
{label && <div className={labelClassName}>{label}</div>}
<div className={switchClassName}>
<input id={labelId} type="checkbox" checked={checked} onChange={this.internalOnChange} />
<span className="gf-form-switch__slider" />
......
......@@ -301,32 +301,28 @@ export default class Logs extends PureComponent<LogsProps, LogsState> {
<div className="logs-options">
<div className="logs-controls">
<Switch label="Timestamp" checked={showUtc} onChange={this.onChangeUtc} small />
<Switch label="Local time" checked={showLocalTime} onChange={this.onChangeLocalTime} small />
<Switch label="Labels" checked={showLabels} onChange={this.onChangeLabels} small />
<Switch label="Timestamp" checked={showUtc} onChange={this.onChangeUtc} />
<Switch label="Local time" checked={showLocalTime} onChange={this.onChangeLocalTime} />
<Switch label="Labels" checked={showLabels} onChange={this.onChangeLabels} />
<Switch
label="Dedup: off"
checked={dedup === LogsDedupStrategy.none}
onChange={() => this.onChangeDedup(LogsDedupStrategy.none)}
small
/>
<Switch
label="Dedup: exact"
checked={dedup === LogsDedupStrategy.exact}
onChange={() => this.onChangeDedup(LogsDedupStrategy.exact)}
small
/>
<Switch
label="Dedup: numbers"
checked={dedup === LogsDedupStrategy.numbers}
onChange={() => this.onChangeDedup(LogsDedupStrategy.numbers)}
small
/>
<Switch
label="Dedup: signature"
checked={dedup === LogsDedupStrategy.signature}
onChange={() => this.onChangeDedup(LogsDedupStrategy.signature)}
small
/>
{hasData &&
meta && (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment