mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05: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
2 changed files with 11 additions and 3 deletions
|
@ -3,6 +3,8 @@ import Button, {ButtonProps} from './Button';
|
||||||
import Popover, {PopoverPosition} from './Popover';
|
import Popover, {PopoverPosition} from './Popover';
|
||||||
import {Icon} from '..';
|
import {Icon} from '..';
|
||||||
|
|
||||||
|
export type SortDirection = 'asc' | 'desc';
|
||||||
|
|
||||||
export type SortItem = {
|
export type SortItem = {
|
||||||
id: string,
|
id: string,
|
||||||
label: string;
|
label: string;
|
||||||
|
@ -11,7 +13,7 @@ export type SortItem = {
|
||||||
|
|
||||||
export interface SortMenuProps {
|
export interface SortMenuProps {
|
||||||
items: SortItem[];
|
items: SortItem[];
|
||||||
direction: string;
|
direction: SortDirection;
|
||||||
onSortChange: (selectedOption: string) => void;
|
onSortChange: (selectedOption: string) => void;
|
||||||
onDirectionChange: (selectedDirection: string) => void;
|
onDirectionChange: (selectedDirection: string) => void;
|
||||||
trigger?: React.ReactNode;
|
trigger?: React.ReactNode;
|
||||||
|
|
|
@ -244,8 +244,14 @@ export const OffersIndexModal = () => {
|
||||||
{id: 'redemptions', label: 'Redemptions'}
|
{id: 'redemptions', label: 'Redemptions'}
|
||||||
]}
|
]}
|
||||||
position='right'
|
position='right'
|
||||||
onDirectionChange={() => {}}
|
onDirectionChange={(selectedDirection) => {
|
||||||
onSortChange={() => {}}
|
// 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'>
|
<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')} />
|
<Button icon='layout-module-1' iconColorClass={selectedLayout === 'card' ? 'text-black' : 'text-grey-500'} link={true} size='sm' onClick={() => setSelectedLayout('card')} />
|
||||||
|
|
Loading…
Add table
Reference in a new issue