diff --git a/src/components/DomainInput/DomainInput.js b/src/components/DomainInput/DomainInput.js new file mode 100644 index 0000000..5c9d00f --- /dev/null +++ b/src/components/DomainInput/DomainInput.js @@ -0,0 +1,37 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; + +export default class DomainInput extends Component { + constructor(props) { + super(props); + this.onAdd = this.onAdd.bind(this); + } + + onAdd() { + this.props.onAdd(this.refs.input.value); + } + + render() { + return ( +
+ e.charCode === 13 ? this.onAdd() : null} + placeholder="Add a domain (example.com or sub.example.com)" + /> + + + + +
+ ); + } +} + +DomainInput.propTypes = { + onAdd: PropTypes.func.isRequired, + onRefresh: PropTypes.func.isRequired +}; diff --git a/src/components/DomainInput/package.json b/src/components/DomainInput/package.json new file mode 100644 index 0000000..361d0d7 --- /dev/null +++ b/src/components/DomainInput/package.json @@ -0,0 +1,6 @@ +{ + "name": "DomainInput", + "version": "0.0.0", + "private": true, + "main": "./DomainInput.js" +}