import React from 'react' import { __ } from '@wordpress/i18n' const SORT_OPTIONS = [ { value: 'recent', label: __('Recent', 'textdomain') }, { value: 'relevance', label: __('Relevance', 'textdomain') }, { value: 'random', label: __('Random', 'textdomain') }, ] as const export interface SortDropdownComponentProps { selected: string isOpen: boolean onToggle: () => void onSelect: (value: string) => void } const SortIcon = () => ( ) const SortDropdownComponent = ({ selected, isOpen, onToggle, onSelect }: SortDropdownComponentProps) => { const effective = selected || 'recent' return ( <> {isOpen && (
{__('Sort By', 'textdomain')}
{SORT_OPTIONS.map((opt) => { const isSel = effective === opt.value return ( ) })}
)} ) } export default SortDropdownComponent