diff --git a/public/app/core/components/Forms/Forms.tsx b/public/app/core/components/Label/Label.tsx similarity index 99% rename from public/app/core/components/Forms/Forms.tsx rename to public/app/core/components/Label/Label.tsx index 543e1a1d6df..6d4fd20dbfe 100644 --- a/public/app/core/components/Forms/Forms.tsx +++ b/public/app/core/components/Label/Label.tsx @@ -19,3 +19,4 @@ export const Label: SFC = props => { ); }; + diff --git a/public/app/core/components/Switch/Switch.tsx b/public/app/core/components/Switch/Switch.tsx new file mode 100644 index 00000000000..ba09267ebd2 --- /dev/null +++ b/public/app/core/components/Switch/Switch.tsx @@ -0,0 +1,46 @@ +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 Switch extends PureComponent { + 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 ( +
+ {label && ( + + )} +
+ +
+
+ ); + } +} diff --git a/public/app/features/teams/TeamSettings.tsx b/public/app/features/teams/TeamSettings.tsx index ef9a5ae0b70..45977de95bf 100644 --- a/public/app/features/teams/TeamSettings.tsx +++ b/public/app/features/teams/TeamSettings.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { connect } from 'react-redux'; -import { Label } from 'app/core/components/Forms/Forms'; +import { Label } from 'app/core/components/Label/Label'; import { Team } from '../../types'; import { updateTeam } from './state/actions'; import { getRouteParamsId } from '../../core/selectors/location'; diff --git a/public/app/plugins/panel/graph2/module.tsx b/public/app/plugins/panel/graph2/module.tsx index 576ece3df61..4011458bea9 100644 --- a/public/app/plugins/panel/graph2/module.tsx +++ b/public/app/plugins/panel/graph2/module.tsx @@ -5,6 +5,7 @@ import React, { PureComponent } from 'react'; // Components import Graph from 'app/viz/Graph'; import { getTimeSeriesVMs } from 'app/viz/state/timeSeries'; +import { Switch } from 'app/core/components/Switch/Switch'; // Types import { PanelProps, NullValueMode } from 'app/types'; @@ -35,10 +36,13 @@ export class Graph2 extends PureComponent { } export class TextOptions extends PureComponent { + onChange = () => {}; + render() { return (
Draw Modes
+
); }