Skip to content

Commit

Permalink
Add user creation
Browse files Browse the repository at this point in the history
  • Loading branch information
javierbrea committed Feb 10, 2019
1 parent aca7b0a commit c736e6e
Show file tree
Hide file tree
Showing 11 changed files with 390 additions and 86 deletions.
57 changes: 37 additions & 20 deletions src/components/field-validation-message/FieldValidationMessage.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,48 @@
import React from "react";
import PropTypes from "prop-types";

import { Form, Label } from "semantic-ui-react";
import { Form, Label, Icon } from "semantic-ui-react";

import { Component as Responsive } from "src/components/responsive";

import "./fieldValidationMessage.css";

export const FieldValidationMessage = ({ message }) => (
<React.Fragment>
<Responsive device="desktop">
<Form.Field className="form__field-validation__container">
<Label basic color="red" pointing="left">
{message}
</Label>
</Form.Field>
</Responsive>
<Responsive device="mobile">
<Form.Field className="form__field-validation__container--mobile">
<Label basic color="red" pointing>
{message}
</Label>
</Form.Field>
</Responsive>
</React.Fragment>
);
const ErrorLabel = ({ message, pointing }) => {
return (
<Label basic color="red" pointing={pointing}>
{message}
</Label>
);
};

ErrorLabel.propTypes = {
message: PropTypes.string,
pointing: PropTypes.any
};

const ValidLabel = () => {
return <Icon name="thumbs up" color="green" />;
};

export const FieldValidationMessage = ({ message, valid }) => {
const Message = !valid ? ErrorLabel : ValidLabel;
return (
<React.Fragment>
<Responsive device="desktop">
<Form.Field className="form__field-validation__container">
<Message pointing="left" message={message} />
</Form.Field>
</Responsive>
<Responsive device="mobile">
<Form.Field className="form__field-validation__container--mobile">
{!valid ? <Message pointing message={message} /> : null}
</Form.Field>
</Responsive>
</React.Fragment>
);
};

FieldValidationMessage.propTypes = {
message: PropTypes.string
message: PropTypes.string,
valid: PropTypes.bool
};
2 changes: 1 addition & 1 deletion src/components/searchable-list/SearchableList.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class SearchableList extends Component {
SearchableList.propTypes = {
children: PropTypes.node,
error: PropTypes.instanceOf(Error),
header: PropTypes.string,
header: PropTypes.node,
loading: PropTypes.bool.isRequired,
menu: PropTypes.node,
sortBy: PropTypes.string,
Expand Down

0 comments on commit c736e6e

Please sign in to comment.