* flare tag line height * . * init * widgets * widgets lists * new tabs on home * instantclick * . * rethinking css * . * . * empty space * campaign widget * . * merge * . * update layout * fix sidebars on home page * . * fix onboarding x * spec * test * test * better handling ads * . * spec * card styling * . * i dont know what have i broken
63 lines
1.7 KiB
JavaScript
63 lines
1.7 KiB
JavaScript
import { h } from 'preact';
|
|
import PropTypes from 'prop-types';
|
|
import { EditorBody } from './EditorBody';
|
|
import { Meta } from './Meta';
|
|
import { ErrorList } from './ErrorList';
|
|
|
|
export const Form = ({
|
|
titleDefaultValue,
|
|
titleOnChange,
|
|
tagsDefaultValue,
|
|
tagsOnInput,
|
|
bodyDefaultValue,
|
|
bodyOnChange,
|
|
bodyHasFocus,
|
|
version,
|
|
mainImage,
|
|
onMainImageUrlChange,
|
|
switchHelpContext,
|
|
errors,
|
|
}) => {
|
|
return (
|
|
<div className="crayons-article-form__content crayons-card">
|
|
{errors && <ErrorList errors={errors} />}
|
|
|
|
{version === 'v2' && (
|
|
<Meta
|
|
titleDefaultValue={titleDefaultValue}
|
|
titleOnChange={titleOnChange}
|
|
tagsDefaultValue={tagsDefaultValue}
|
|
tagsOnInput={tagsOnInput}
|
|
mainImage={mainImage}
|
|
onMainImageUrlChange={onMainImageUrlChange}
|
|
switchHelpContext={switchHelpContext}
|
|
/>
|
|
)}
|
|
|
|
<EditorBody
|
|
defaultValue={bodyDefaultValue}
|
|
onChange={bodyOnChange}
|
|
hasFocus={bodyHasFocus}
|
|
switchHelpContext={switchHelpContext}
|
|
version={version}
|
|
/>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
Form.propTypes = {
|
|
titleDefaultValue: PropTypes.string.isRequired,
|
|
titleOnChange: PropTypes.func.isRequired,
|
|
tagsDefaultValue: PropTypes.string.isRequired,
|
|
tagsOnInput: PropTypes.func.isRequired,
|
|
bodyDefaultValue: PropTypes.string.isRequired,
|
|
bodyOnChange: PropTypes.func.isRequired,
|
|
bodyHasFocus: PropTypes.bool.isRequired,
|
|
version: PropTypes.string.isRequired,
|
|
mainImage: PropTypes.string.isRequired,
|
|
onMainImageUrlChange: PropTypes.func.isRequired,
|
|
switchHelpContext: PropTypes.func.isRequired,
|
|
errors: PropTypes.func.isRequired,
|
|
};
|
|
|
|
Form.displayName = 'Form';
|