Skip to content

Commit

Permalink
fix(Form): Update From Based in Audit (patternfly#1185)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlabaj authored and dlabaj committed Jan 17, 2019
1 parent bbdf4cc commit a42ab72
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 56 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Simple from './examples/SimpleForm';
import Horizontal from './examples/HorizontalForm';
import Various from './examples/VariousLabelsForm';
import Invalid from './examples/InvalidForm';
import { Form, FormGroup, ActionGroup } from '@patternfly/react-core';

Expand All @@ -14,11 +13,6 @@ export default {
examples: [
{ component: Simple, title: 'Simple Form' },
{ component: Horizontal, title: 'Horizontal form' },
{ component: Invalid, title: 'Invalid form' },
{
component: Various,
title: 'Various labels and helper text',
description: 'Label and helperText can be a string, a function or a node.'
}
{ component: Invalid, title: 'Invalid form' }
]
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,35 @@ import React from 'react';
import { Form, FormGroup, TextInput } from '@patternfly/react-core';

class InvalidForm extends React.Component {
state = {
value: 'Five',
isValid: false
};

handleTextInputChange = value => {
this.setState({ value, isValid: /^\d+$/.test(value) });
};

render() {
const { value, isValid } = this.state;

return (
<Form>
<FormGroup
isRequired
label="Email"
helperText="This is should be your email"
helperTextInvalid="Your email is not in a correct format"
fieldId="email-label"
isValid={false}
>
<TextInput isValid={false} value="email||email.com" id="email-label" aria-describedby="email-label-helper" />
</FormGroup>
<FormGroup
label="Age"
label="Age:"
type="number"
helperText="Please write your age"
helperTextInvalid="Age has to be a number"
fieldId="age"
isValid={false}
isValid={isValid}
>
<TextInput isValid={false} value="Five" id="age" aria-describedby="age-helper" />
<TextInput
isValid={isValid}
value={value}
id="age"
aria-describedby="age-helper"
onChange={this.handleTextInputChange}
/>
</FormGroup>
</Form>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ class SimpleForm extends React.Component {
aria-label="Please don't contact me"
/>
</FormGroup>
<FormGroup label="Additional Note:" fieldId="simple-form-note">
<TextInput isDisabled type="text" id="simple-form-note" name="simple-form-number" value="disabled" />
</FormGroup>
<FormGroup fieldId="checkbox1">
<Checkbox label="I'd like updates via email" id="checkbox1" name="checkbox1" aria-label="Update via email" />
</FormGroup>
Expand Down

This file was deleted.

0 comments on commit a42ab72

Please sign in to comment.