import { h } from 'preact'; import PropTypes from 'prop-types'; import moment from 'moment'; import { Dropdown, ButtonNew as Button } from '@crayons'; import CogIcon from '@images/cog.svg'; /** * Component comprising a trigger button and dropdown with additional post options. * * @param {Object} props * @param {Object} props.passedData The current post options data * @param {Function} props.onSaveDraft Callback for when the post draft is saved * @param {Function} props.onConfigChange Callback for when the config options have changed */ export const Options = ({ passedData: { published = false, publishedAtDate = '', publishedAtTime = '', publishedAtWas = '', timezone = Intl.DateTimeFormat().resolvedOptions().timeZone, allSeries = [], canonicalUrl = '', series = '', }, schedulingEnabled, onSaveDraft, onConfigChange, previewLoading, }) => { let publishedField = ''; let existingSeries = ''; let publishedAtField = ''; const wasScheduled = publishedAtWas && moment(publishedAtWas) > moment(); // allow to edit published at if it was not set earlier or if it's in the future const editablePublishedAt = !publishedAtWas || wasScheduled; if (allSeries.length > 0) { const seriesNames = allSeries.map((name, index) => { return ( ); }); existingSeries = (
Change meta tag
{` `}
canonical_url
{` `}
if this post was first published elsewhere (like your own blog).
Will this post be part of a series? Give the series a unique name. (Series visible once it has multiple posts)
{existingSeries}