import { Menu, Transition } from '@headlessui/react'; import * as React from 'react'; import { SortOption } from '../constants/SortOption'; import { ChevronDownIcon } from '@heroicons/react/solid'; import { Fragment } from 'react'; import { MenuItem } from './MenuItem'; import { MenuItems } from './MenuItems'; import { MenuButton } from './MenuButton'; export interface ISortingProps { currentSorting: SortOption; switchSorting: (sortId: SortOption) => void; } export const sortOptions = [ { name: "Last modified", id: SortOption.LastModified }, { name: "By filename (asc)", id: SortOption.FileNameAsc }, { name: "By filename (desc)", id: SortOption.FileNameDesc }, ]; export const Sorting: React.FunctionComponent = ({currentSorting, switchSorting}: React.PropsWithChildren) => { const crntSort = sortOptions.find(x => x.id === currentSorting); return (
{sortOptions.map((option) => ( ))}
); };