/** * WordPress dependencies */ import { Fragment } from '@wordpress/element'; import { PanelBody, ToggleControl, Disabled, SelectControl, } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; /** * Internal dependencies */ import { InspectorControls, BlockAlignmentToolbar, BlockControls, ServerSideRender, } from '@wordpress/editor'; export default function ArchivesEdit( { attributes, setAttributes, postTypes } ) { const { align, showPostCounts, displayAsDropdown, postType, type } = attributes; return ( setAttributes( { displayAsDropdown: ! displayAsDropdown } ) } /> setAttributes( { showPostCounts: ! showPostCounts } ) } /> setAttributes( { type: value } ) } options={ [ { value: 'yearly', label: __( 'Yearly', 'advanced-archive-blocks' ), }, { value: 'monthly', label: __( 'Monthly', 'advanced-archive-blocks' ), }, { value: 'daily', label: __( 'Daily', 'advanced-archive-blocks' ), }, { value: 'weekly', label: __( 'Weekly', 'advanced-archive-blocks' ), }, ] } /> setAttributes( { postType: value } ) } options={ postTypes.map( ( { slug, name } ) => ( { value: slug, label: name } ) ) } /> { setAttributes( { align: nextAlign } ); } } controls={ [ 'left', 'center', 'right' ] } /> ); }