docbrown/app/javascript/listings/elements/contactViaConnect.jsx
Hoang Vo 293ba5231b Fix eslint issues in app/javascript/listings (#4253)
* Fix some eslint and a11y issues

* Add a11y fixed to snapshot

* Fix missing whitespace that cause test fail

* Fix code duplicate

* Config eslint to allows the label as a sibling

* Use 'error' instead of 2 in eslintrc

* Correct propTypes in SingleListing

* Add missing id prop for select

* Add space between two functions

* onKeyPress only register Enter

* Allow space key also to activate action

* Use a common function for three event handlers
2019-10-14 14:23:20 -04:00

25 lines
697 B
JavaScript

import { h } from 'preact';
import PropTypes from 'prop-types';
const ContactViaConnect = ({ onChange, checked }) => (
<div className="field">
<label className="listingform__label" htmlFor="contact_via_connect">
Allow Users to Message Me Via In-App Chat (DEV Connect)
</label>
<input
type="checkbox"
className="listingform__input listingform__contact_via_connect"
id="contact_via_connect"
name="classified_listing[contact_via_connect]"
onInput={onChange}
checked={checked}
/>
</div>
);
ContactViaConnect.propTypes = {
onChange: PropTypes.func.isRequired,
checked: PropTypes.bool.isRequired,
};
export default ContactViaConnect;