import { InspectorControls } from "@wordpress/block-editor"; import { PanelBody, TextControl, RangeControl, SelectControl, ToggleControl, } from "@wordpress/components"; import { __ } from "@wordpress/i18n"; import ServerSideRender from "@wordpress/server-side-render"; export interface TripCategoryBlockAttributes { order: "asc" | "desc"; columns: number; per_page: number; title: string; show_pagination: boolean; category: string; show_trip_count: boolean; show_description: boolean; show_image: boolean; hide_empty: boolean; featured_only: boolean; } interface EditProps { attributes: TripCategoryBlockAttributes; setAttributes: (attrs: Partial) => void; } export default function Edit({ attributes, setAttributes }: EditProps) { const { order, columns, per_page, title, show_pagination, category, show_trip_count, show_description, show_image, hide_empty, featured_only, } = attributes; return ( <> setAttributes({ title: value })} /> setAttributes({ category: value })} /> setAttributes({ order: value as "asc" | "desc" }) } /> setAttributes({ per_page: value !== undefined && value !== null ? value : 10, }) } min={1} max={50} /> setAttributes({ columns: value !== undefined && value !== null ? value : 3, }) } min={1} max={6} /> setAttributes({ show_pagination: value }) } /> setAttributes({ show_trip_count: value }) } /> setAttributes({ show_description: value }) } /> setAttributes({ show_image: value })} /> setAttributes({ hide_empty: value })} /> setAttributes({ featured_only: value }) } />
); }