* Refactored drag n drop functionality to a hook and component. * Add the snackbar to the article editor. * Now you can drag and drop images in the post body content. * Cleaning up a few things. * Now post cover images can be dragged and dropped. * Removed unused empty function. * Added @testing-library/preact-hooks so that we can test hooks. * Some renaming, small refactor. * Added tests * Added more tests. * Added more tests. * Added message about dropping only one image in post body. * Added message about dropping only one image for cover image. * put onDrop into it's own meethod. * More tests. * Added some API documentation. * Updated editor help with drag and drop image help. * drag and drop styling * . * revert * Fixed broken test. Co-authored-by: Nick Taylor <nick@dev.to>
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
import { h } from 'preact';
|
|
import PropTypes from 'prop-types';
|
|
import { ArticleCoverImage } from './ArticleCoverImage';
|
|
import { TagsField } from './TagsField';
|
|
import { Title } from './Title';
|
|
|
|
export const Meta = ({
|
|
titleDefaultValue,
|
|
titleOnChange,
|
|
tagsDefaultValue,
|
|
tagsOnInput,
|
|
mainImage,
|
|
onMainImageUrlChange,
|
|
switchHelpContext,
|
|
}) => {
|
|
return (
|
|
<div className="crayons-article-form__top text-padding drop-area">
|
|
<ArticleCoverImage
|
|
mainImage={mainImage}
|
|
onMainImageUrlChange={onMainImageUrlChange}
|
|
/>
|
|
<Title
|
|
defaultValue={titleDefaultValue}
|
|
onChange={titleOnChange}
|
|
switchHelpContext={switchHelpContext}
|
|
/>
|
|
<TagsField
|
|
defaultValue={tagsDefaultValue}
|
|
onInput={tagsOnInput}
|
|
switchHelpContext={switchHelpContext}
|
|
/>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
Meta.propTypes = {
|
|
titleDefaultValue: PropTypes.string.isRequired,
|
|
titleOnChange: PropTypes.func.isRequired,
|
|
tagsDefaultValue: PropTypes.string.isRequired,
|
|
tagsOnInput: PropTypes.func.isRequired,
|
|
mainImage: PropTypes.string.isRequired,
|
|
onMainImageUrlChange: PropTypes.func.isRequired,
|
|
switchHelpContext: PropTypes.func.isRequired,
|
|
};
|
|
|
|
Meta.displayName = 'Meta';
|