docbrown/app/javascript/article-form/components/Meta.jsx
Ben Halpern ec7adf56fe
Allow admins to set cover image height configs (#19936)
* Initial basic work

* Bulk of related work, including find/replace on the inputs

* Adjust some tests

* Adjust some specs

* Fix a few more tests

* Clean up tests

* Adjust tests

* Test fiddle

* Adjust crop back to be a param

* Update tests

* Set proper defaults

* Fix some styling

* Adjust enrichment logic and tests

* Adjust form JS

* Update test snapshot

* Clean up formatting

* Fix spec name

* Adjust some css and defaults

* Adjust translation for image provider options

* Switch from fill to fill-down

* Proper fallback image

* Fix tests

* Update app/services/images/optimizer.rb

Co-authored-by: Mac Siri <mac@forem.com>

---------

Co-authored-by: Mac Siri <mac@forem.com>
2023-08-21 13:25:16 -04:00

52 lines
1.4 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,
coverImageCrop,
coverImageHeight,
}) => {
return (
<div className="crayons-article-form__top text-padding drop-area">
<ArticleCoverImage
mainImage={mainImage}
onMainImageUrlChange={onMainImageUrlChange}
coverImageCrop={coverImageCrop}
coverImageHeight={coverImageHeight}
/>
<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,
onMainImageUrlChange: PropTypes.func.isRequired,
switchHelpContext: PropTypes.func.isRequired,
coverImageHeight: PropTypes.string.isRequired,
coverImageCrop: PropTypes.string.isRequired,
};
Meta.displayName = 'Meta';