Commit 4c402743 by Peter Holmberg

renaming after pr feedback

parent 83fbf52a
import React from 'react';
import { shallow } from 'enzyme';
import { FormGroup, Props } from './FormGroup';
import { FormField, Props } from './FormField';
const setup = (propOverrides?: object) => {
const props: Props = {
......@@ -14,7 +14,7 @@ const setup = (propOverrides?: object) => {
Object.assign(props, propOverrides);
return shallow(<FormGroup {...props} />);
return shallow(<FormField {...props} />);
};
describe('Render', () => {
......
import React, { SFC } from 'react';
import React, { InputHTMLAttributes, FunctionComponent } from 'react';
import { Label } from '..';
export interface Props {
label: string;
inputProps: {};
inputProps: InputHTMLAttributes<HTMLInputElement>;
labelWidth?: number;
inputWidth?: number;
}
......@@ -14,7 +14,7 @@ const defaultProps = {
inputWidth: 12,
};
const FormGroup: SFC<Props> = ({ label, labelWidth, inputProps, inputWidth }) => {
const FormField: FunctionComponent<Props> = ({ label, labelWidth, inputProps, inputWidth }) => {
return (
<div className="gf-form">
<Label width={labelWidth}>{label}</Label>
......@@ -23,5 +23,5 @@ const FormGroup: SFC<Props> = ({ label, labelWidth, inputProps, inputWidth }) =>
);
};
FormGroup.defaultProps = defaultProps;
export { FormGroup };
FormField.defaultProps = defaultProps;
export { FormField };
......@@ -9,7 +9,7 @@ interface Props {
isInvalid?: boolean;
}
export const GfFormLabel: SFC<Props> = ({ children, isFocused, isInvalid, className, htmlFor, ...rest }) => {
export const FormLabel: SFC<Props> = ({ children, isFocused, isInvalid, className, htmlFor, ...rest }) => {
const classes = classNames('gf-form-label', className, {
'gf-form-label--is-focused': isFocused,
'gf-form-label--is-invalid': isInvalid,
......
......@@ -10,8 +10,8 @@ export { NoOptionsMessage } from './Select/NoOptionsMessage';
export { default as resetSelectStyles } from './Select/resetSelectStyles';
// Forms
export { GfFormLabel } from './GfFormLabel/GfFormLabel';
export { FormGroup } from './FormGroup/FormGroup';
export { FormLabel } from './FormLabel/FormLabel';
export { FormField } from './FormGroup/FormField';
export { Label } from './Label/Label';
export { LoadingPlaceholder } from './LoadingPlaceholder/LoadingPlaceholder';
......
......@@ -10,7 +10,7 @@ import { Input } from 'app/core/components/Form';
import { EventsWithValidation } from 'app/core/components/Form/Input';
import { InputStatus } from 'app/core/components/Form/Input';
import DataSourceOption from './DataSourceOption';
import { GfFormLabel } from '@grafana/ui';
import { FormLabel } from '@grafana/ui';
// Types
import { PanelModel } from '../panel_model';
......@@ -164,7 +164,7 @@ export class QueryOptions extends PureComponent<Props, State> {
{this.renderOptions()}
<div className="gf-form">
<GfFormLabel>Relative time</GfFormLabel>
<FormLabel>Relative time</FormLabel>
<Input
type="text"
className="width-6"
......
......@@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
import { GaugeOptions, PanelOptionsProps, PanelOptionsGroup } from '@grafana/ui';
import { Switch } from 'app/core/components/Switch/Switch';
import { FormGroup } from '@grafana/ui/src';
import { FormField } from '@grafana/ui/src';
export default class GaugeOptionsEditor extends PureComponent<PanelOptionsProps<GaugeOptions>> {
onToggleThresholdLabels = () =>
......@@ -21,12 +21,12 @@ export default class GaugeOptionsEditor extends PureComponent<PanelOptionsProps<
return (
<PanelOptionsGroup title="Gauge">
<FormGroup
<FormField
label="Min value"
labelWidth={8}
inputProps={{ onChange: event => this.onMinValueChange(event), value: minValue }}
/>
<FormGroup
<FormField
label="Max value"
labelWidth={8}
inputProps={{ onChange: event => this.onMaxValueChange(event), value: maxValue }}
......
import React, { PureComponent } from 'react';
import { FormGroup, Label, MappingType, RangeMap, Select, ValueMap } from '@grafana/ui';
import { FormField, Label, MappingType, RangeMap, Select, ValueMap } from '@grafana/ui';
interface Props {
mapping: ValueMap | RangeMap;
......@@ -61,7 +61,7 @@ export default class MappingRow extends PureComponent<Props, State> {
if (type === MappingType.RangeToText) {
return (
<>
<FormGroup
<FormField
label="From"
labelWidth={4}
inputProps={{
......@@ -71,7 +71,7 @@ export default class MappingRow extends PureComponent<Props, State> {
}}
inputWidth={8}
/>
<FormGroup
<FormField
label="To"
labelWidth={4}
inputProps={{
......@@ -96,7 +96,7 @@ export default class MappingRow extends PureComponent<Props, State> {
return (
<>
<FormGroup
<FormField
label="Value"
labelWidth={4}
inputProps={{
......
import React, { PureComponent } from 'react';
import { FormGroup, Label, GaugeOptions, PanelOptionsProps, PanelOptionsGroup, Select } from '@grafana/ui';
import { FormField, Label, GaugeOptions, PanelOptionsProps, PanelOptionsGroup, Select } from '@grafana/ui';
import UnitPicker from 'app/core/components/Select/UnitPicker';
const statOptions = [
......@@ -51,7 +51,7 @@ export default class ValueOptions extends PureComponent<PanelOptionsProps<GaugeO
<Label width={labelWidth}>Unit</Label>
<UnitPicker defaultValue={unit} onChange={this.onUnitChange} />
</div>
<FormGroup
<FormField
label="Decimals"
labelWidth={labelWidth}
inputProps={{
......@@ -61,7 +61,7 @@ export default class ValueOptions extends PureComponent<PanelOptionsProps<GaugeO
type: 'number',
}}
/>
<FormGroup
<FormField
label="Prefix"
labelWidth={labelWidth}
inputProps={{
......@@ -69,7 +69,7 @@ export default class ValueOptions extends PureComponent<PanelOptionsProps<GaugeO
value: prefix || '',
}}
/>
<FormGroup
<FormField
label="Suffix"
labelWidth={labelWidth}
inputProps={{
......
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