mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 11:55:01 +03:00
Added a type for the sorting direction of SortMenu component (#19062)
refs https://github.com/TryGhost/Product/issues/4162
This commit is contained in:
parent
ccd1e355e1
commit
f3aadab613
@ -3,6 +3,8 @@ import Button, {ButtonProps} from './Button';
|
||||
import Popover, {PopoverPosition} from './Popover';
|
||||
import {Icon} from '..';
|
||||
|
||||
export type SortDirection = 'asc' | 'desc';
|
||||
|
||||
export type SortItem = {
|
||||
id: string,
|
||||
label: string;
|
||||
@ -11,7 +13,7 @@ export type SortItem = {
|
||||
|
||||
export interface SortMenuProps {
|
||||
items: SortItem[];
|
||||
direction: string;
|
||||
direction: SortDirection;
|
||||
onSortChange: (selectedOption: string) => void;
|
||||
onDirectionChange: (selectedDirection: string) => void;
|
||||
trigger?: React.ReactNode;
|
||||
|
@ -244,8 +244,14 @@ export const OffersIndexModal = () => {
|
||||
{id: 'redemptions', label: 'Redemptions'}
|
||||
]}
|
||||
position='right'
|
||||
onDirectionChange={() => {}}
|
||||
onSortChange={() => {}}
|
||||
onDirectionChange={(selectedDirection) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Sorting direction: ${selectedDirection}`);
|
||||
}}
|
||||
onSortChange={(selectedOption) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Sorting option: ${selectedOption}`);
|
||||
}}
|
||||
/>
|
||||
<div className='flex gap-3'>
|
||||
<Button icon='layout-module-1' iconColorClass={selectedLayout === 'card' ? 'text-black' : 'text-grey-500'} link={true} size='sm' onClick={() => setSelectedLayout('card')} />
|
||||
|
Loading…
Reference in New Issue
Block a user