import * as React from 'react'; import I18n from 'i18n-js'; import Button from '../common/Button'; import { SmallMutedText } from '../common/CustomTexts'; import { MarkdownIcon } from '../common/Icons'; import Dropzone from '../common/Dropzone'; import ITenantSetting from '../../interfaces/ITenantSetting'; interface Props { title: string; description: string; attachments: File[]; handleTitleChange(title: string): void; handleDescriptionChange(description: string): void; handleAttachmentsChange(attachments: File[]): void; handleSubmit(e: object): void; dnf1: string; dnf2: string; handleDnf1Change(dnf1: string): void; handleDnf2Change(dnf2: string): void; tenantSetting: ITenantSetting; currentUserFullName: string; isSubmissionAnonymous: boolean; } const NewPostForm = ({ title, description, attachments, handleTitleChange, handleDescriptionChange, handleAttachmentsChange, handleSubmit, dnf1, dnf2, handleDnf1Change, handleDnf2Change, tenantSetting, currentUserFullName, isSubmissionAnonymous, }: Props) => (
{ /* Title */ }
handleTitleChange(e.target.value)} maxLength={128} placeholder={I18n.t('board.new_post.title')} id="postTitle" className="form-control" autoFocus />
{ /* Honeypot field 1 */ }
handleDnf1Change(e.target.value)} maxLength={128} placeholder="email" autoComplete="off" id="email" className="form-control" />
{ /* Honeypot field 2 */ } handleDnf2Change(e.target.value)} maxLength={128} placeholder="name" autoComplete="off" tabIndex={-1} id="name" className="form-control" /> { /* Description */ }
{ /* Attachments */ } { tenantSetting.allow_attachment_upload && !isSubmissionAnonymous &&
} { isSubmissionAnonymous ? I18n.t('board.new_post.anonymous_submission_help') : I18n.t('board.new_post.non_anonymous_submission_help', { name: currentUserFullName }) }
); export default NewPostForm;