@@ -6,6 +6,7 @@ import { cn } from "@/lib/utils"
66import { Button , Menu , MenuContent , MenuItem , MenuTrigger , TextInput } from "@code0-tech/pictor"
77import { IconChevronDown , IconSearch } from "@tabler/icons-react"
88import { Section } from "@/components/ui/Section"
9+ import { Switch , type SwitchOption } from "@/components/ui/Switch"
910import type { ChangeEvent } from "react"
1011import { useMemo , useState } from "react"
1112
@@ -64,6 +65,10 @@ export function ActionListSection({ actions, locale, content }: { actions: Actio
6465 const allCategoriesLabel = content . allCategoriesLabel || "All Categories"
6566 const selectedCategory = CATEGORY_LABEL_KEYS . find ( ( { tag } ) => tag === selectedTag )
6667 const selectedCategoryLabel = selectedCategory ? content . categoryLabels ?. [ selectedCategory . label ] || selectedCategory . tag : allCategoriesLabel
68+ const sortOptions : SwitchOption < SortOrder > [ ] = [
69+ { value : "newest" , label : content . sortNewestLabel } ,
70+ { value : "oldest" , label : content . sortOldestLabel } ,
71+ ]
6772 const filteredActions = useMemo ( ( ) => {
6873 const term = search . trim ( ) . toLowerCase ( )
6974 return actions
@@ -88,7 +93,7 @@ export function ActionListSection({ actions, locale, content }: { actions: Actio
8893 headingLevel = { 1 }
8994 >
9095 < div className = "flex flex-col gap-4" >
91- < div className = "flex flex-col gap-2 sm:gap-4 sm:flex-row " >
96+ < div className = "flex flex-row gap-2 sm:gap-4" >
9297 < div className = "min-w-0 flex-1" >
9398 < TextInput
9499 value = { search }
@@ -99,18 +104,7 @@ export function ActionListSection({ actions, locale, content }: { actions: Actio
99104 className = "w-full! text-white!"
100105 />
101106 </ div >
102- < Menu modal = { false } >
103- < MenuTrigger asChild >
104- < Button className = "w-full! justify-between sm:w-auto! sm:min-w-36" >
105- { sortOrder === "newest" ? content . sortNewestLabel : content . sortOldestLabel }
106- < IconChevronDown size = { 16 } />
107- </ Button >
108- </ MenuTrigger >
109- < MenuContent className = "w-(--radix-dropdown-menu-trigger-width)" >
110- < MenuItem onClick = { ( ) => setSortOrder ( "newest" ) } > { content . sortNewestLabel } </ MenuItem >
111- < MenuItem onClick = { ( ) => setSortOrder ( "oldest" ) } > { content . sortOldestLabel } </ MenuItem >
112- </ MenuContent >
113- </ Menu >
107+ < Switch value = { sortOrder } options = { sortOptions } onChange = { setSortOrder } className = "w-auto shrink-0 [&>div]:h-10.5 [&>div>button]:py-0" fitContent />
114108 </ div >
115109 </ div >
116110 < div className = "grid items-start gap-6 md:grid-cols-[13rem_minmax(0,1fr)]" >
0 commit comments