import _noop from "lodash/fp/noop";
import _get from "lodash/fp/get";
import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { SrcPropType } from '../../../util/proptypes';
import Provider from '../../../atom/provider';
import Button from '../../../atom/button';
import style from './style.css';
const ForumComment = (props, context) => {
  const {
    translate,
    skin
  } = context;
  const {
    avatar,
    onPost,
    onChange,
    value,
    textareaDisabled,
    postDisabled,
    newPost = false,
    profileAvatarAlt
  } = props;
  const primary = _get('common.primary', skin);
  const light = _get('common.light', skin);
  const avatarView = avatar ? /*#__PURE__*/React.createElement("div", {
    className: style.image
  }, /*#__PURE__*/React.createElement("img", {
    src: avatar,
    alt: profileAvatarAlt
  })) : null;
  const button = /*#__PURE__*/React.createElement("div", {
    className: style.post
  }, /*#__PURE__*/React.createElement(Button, {
    type: "link",
    onClick: !postDisabled ? onPost : _noop,
    disabled: postDisabled,
    submitValue: translate('Post'),
    "aria-label": translate('post_comment_aria_label'),
    style: {
      backgroundColor: postDisabled ? light : primary
    },
    className: postDisabled ? style.disabledButton : style.button
  }));
  return /*#__PURE__*/React.createElement("div", {
    "data-name": "forumComment",
    className: classnames(style.container, newPost ? style.newPost : null)
  }, /*#__PURE__*/React.createElement("div", {
    className: classnames(style.wrapper, newPost ? style.newPost : null)
  }, avatarView, /*#__PURE__*/React.createElement("div", {
    className: style.comment
  }, /*#__PURE__*/React.createElement("textarea", {
    placeholder: translate('comment_aria_label'),
    title: translate('comment_aria_label'),
    "aria-label": translate('comment_aria_label'),
    value: value,
    onChange: onChange,
    disabled: textareaDisabled
  }))), button);
};
ForumComment.contextTypes = {
  translate: Provider.childContextTypes.translate,
  skin: Provider.childContextTypes.skin
};
ForumComment.propTypes = process.env.NODE_ENV !== "production" ? {
  value: PropTypes.string,
  profileAvatarAlt: PropTypes.string,
  avatar: SrcPropType,
  onChange: PropTypes.func,
  onPost: PropTypes.func,
  newPost: PropTypes.bool,
  textareaDisabled: PropTypes.bool,
  postDisabled: PropTypes.bool
} : {};
export default ForumComment;
//# sourceMappingURL=index.js.map