@@ -8,12 +8,6 @@ import { Category, ItemData, Tag } from '@/lib/content';
88import { useLayoutTheme , LayoutHome } from '@/components/context' ;
99import { Paginate } from '@/components/filters/components/pagination/paginate' ;
1010import { totalPages } from '@/lib/paginate' ;
11- import SortMenu , { SortOption } from '@/components/sort-menu' ;
12- import ViewToggle from '@/components/view-toggle' ;
13- import { SearchInput } from '@/components/ui/search-input' ;
14- import { useFilters } from '@/hooks/use-filters' ;
15- import { ListingClient } from '@/components/shared-card/listing-client' ;
16- import { CardPresets } from '@/components/shared-card' ;
1711import { ListingSkeleton } from '@/components/ui/skeleton' ;
1812import { Container } from '@/components/ui/container' ;
1913
@@ -43,21 +37,11 @@ function ListingCategoriesContent(props: ListingCategoriesProps) {
4337 description = { t ( 'common.CATEGORIES_DESCRIPTION' , {
4438 defaultValue : 'Browse top categories to find your best Open Source software options.'
4539 } ) }
46- className = "min-h-screen text-center"
40+ className = "min-h-screen text-center pb-24 "
4741 >
4842 { layoutHome === LayoutHome . HOME_ONE && < HomeOneLayout categories = { props . categories } /> }
49- { layoutHome === LayoutHome . HOME_TWO && (
50- < HomeTwoLayout
51- items = { props . items }
52- total = { props . total }
53- start = { props . start }
54- page = { props . page }
55- basePath = { props . basePath }
56- categories = { props . categories }
57- tags = { props . tags }
58- />
59- ) }
60- { paginationType === 'standard' && (
43+ { layoutHome === LayoutHome . HOME_TWO && < HomeTwoLayout categories = { props . categories } /> }
44+ { paginationType === 'standard' && totalPages ( props . categories . length ) > 1 && (
6145 < footer className = "flex items-center justify-center" >
6246 < Paginate
6347 basePath = { props . basePath }
@@ -140,88 +124,61 @@ function HomeOneLayout({ categories }: { categories: Category[] }) {
140124}
141125
142126function HomeTwoLayout ( {
143- items,
144- total,
145- start,
146- page,
147- basePath,
148- categories : allCategories ,
149- tags
127+ categories
150128} : {
151- items : ItemData [ ] ;
152- total : number ;
153- start : number ;
154- page : number ;
155- basePath : string ;
156129 categories : Category [ ] ;
157- tags : Tag [ ] ;
158130} ) {
159- const { layoutKey, setLayoutKey, paginationType } = useLayoutTheme ( ) ;
160- const { searchTerm, setSearchTerm, setSortBy, sortBy } = useFilters ( ) ;
161131 const t = useTranslations ( ) ;
162132
163- const sortOptions : SortOption [ ] = [
164- { value : 'popularity' , label : t ( 'listing.POPULARITY' ) } ,
165- { value : 'name-asc' , label : t ( 'listing.NAME_A_Z' ) } ,
166- { value : 'name-desc' , label : t ( 'listing.NAME_Z_A' ) } ,
167- { value : 'date-asc' , label : t ( 'listing.OLDEST' ) }
168- ] ;
169-
170- // Calculate paginated items
171- const perPage = useLayoutTheme ( ) . itemsPerPage ?? 12 ;
172- const paginatedItems = items . slice ( ( page - 1 ) * perPage , page * perPage ) ;
173-
174133 return (
175134 < Container maxWidth = "7xl" padding = "lg" useGlobalWidth >
176- < div className = "md:sticky md:top-4 md:self-start pt-6 sm:pt-8 md:pt-11 z-10 flex flex-col" >
177- { /* Mobile Layout */ }
178- < div className = "block md:hidden space-y-3 px-2" >
179- { /* Search Bar - Full Width */ }
180- < div className = "w-full" >
181- < SearchInput searchTerm = { searchTerm } setSearchTerm = { setSearchTerm } className = "w-full" />
182- </ div >
183-
184- { /* Sort and View in one row */ }
185- < div className = "flex items-center justify-between gap-2" >
186- < SortMenu
187- className = "h-8 flex-1 text-xs sm:text-sm"
188- options = { sortOptions }
189- value = { sortBy }
190- onSortChange = { ( value ) => setSortBy ( value as any ) }
191- ariaLabel = "Sort items"
192- />
193- < ViewToggle activeView = { layoutKey } onViewChange = { ( newView ) => setLayoutKey ( newView ) } />
194- </ div >
195- </ div >
196-
197- { /* Desktop Layout */ }
198- < div className = "hidden md:flex items-center justify-between px-2 gap-4" >
199- < SortMenu
200- className = "h-8 min-w-[180px] text-sm"
201- options = { sortOptions }
202- value = { sortBy }
203- onSortChange = { ( value ) => setSortBy ( value as any ) }
204- ariaLabel = "Sort items"
205- />
206- < div className = "flex items-center gap-3" >
207- < div className = "w-64 lg:w-80" >
208- < SearchInput searchTerm = { searchTerm } setSearchTerm = { setSearchTerm } />
135+ { /* Breadcrumb */ }
136+ < nav className = "flex mb-8 justify-center" aria-label = "Breadcrumb" >
137+ < ol className = "inline-flex items-center space-x-1 md:space-x-3" >
138+ < li className = "inline-flex items-center text-black dark:text-white" >
139+ < Link
140+ href = "/"
141+ className = "inline-flex items-center text-sm font-medium text-black dark:text-white hover:text-white dark:hover:text-white transition-colors duration-300"
142+ >
143+ < svg
144+ className = "w-3 h-3 mr-2.5 text-dark--theme-800 dark:text-white"
145+ aria-hidden = "true"
146+ xmlns = "http://www.w3.org/2000/svg"
147+ fill = "currentColor"
148+ viewBox = "0 0 20 20"
149+ >
150+ < path d = "m19.707 9.293-2-2-7-7a1 1 0 0 0-1.414 0l-7 7-2 2a1 1 0 0 0 1.414 1.414L2 10.414V18a2 2 0 0 0 2 2h3a1 1 0 0 0 1-1v-4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v4a1 1 0 0 0 1 1h3a2 2 0 0 0 2-2v-7.586l.293.293a1 1 0 0 0 1.414-1.414Z" />
151+ </ svg >
152+ { t ( 'common.HOME' ) }
153+ </ Link >
154+ </ li >
155+ < li >
156+ < div className = "flex items-center" >
157+ < svg
158+ className = "w-3 h-3 text-dark--theme-800 dark:text-white mx-1"
159+ aria-hidden = "true"
160+ xmlns = "http://www.w3.org/2000/svg"
161+ fill = "none"
162+ viewBox = "0 0 6 10"
163+ >
164+ < path
165+ stroke = "currentColor"
166+ strokeLinecap = "round"
167+ strokeLinejoin = "round"
168+ strokeWidth = "2"
169+ d = "m1 9 4-4-4-4"
170+ />
171+ </ svg >
172+ < span className = "ml-1 text-sm font-medium text-gray-800 dark:text-white/50 md:ml-2 transition-colors duration-300" >
173+ { t ( 'listing.CATEGORIES' ) }
174+ </ span >
209175 </ div >
210- < ViewToggle activeView = { layoutKey } onViewChange = { ( newView ) => setLayoutKey ( newView ) } />
211- </ div >
212- </ div >
213- </ div >
214- < div className = "md:h-4 md:w-full" />
215- < ListingClient
216- items = { paginationType === 'infinite' ? items : paginatedItems }
217- total = { total }
218- start = { start }
219- page = { page }
220- basePath = { basePath }
221- categories = { allCategories }
222- tags = { tags }
223- config = { CardPresets . showViewToggle }
224- />
176+ </ li >
177+ </ ol >
178+ </ nav >
179+
180+ { /* Categories Grid */ }
181+ { categories . length > 0 && < CategoriesGrid categories = { categories } /> }
225182 </ Container >
226183 ) ;
227184}
0 commit comments