This repository was archived by the owner on May 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +69
-16
lines changed Expand file tree Collapse file tree 3 files changed +69
-16
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ interface Props {
2626
2727const GuideList : React . FC < Props > = ( { className, guides } ) => {
2828 const { searchParams } = useParams ( )
29- const selectedTags = searchParams . get ( 'tags' ) ?. split ( ',' ) || [ ]
29+ const selectedTags = searchParams ? .get ( 'tags' ) ?. split ( ',' ) || [ ]
3030 const { currentLanguage } = useLang ( )
3131 const filteredGuides = guides . filter ( ( guide ) => {
3232 let include = true
@@ -40,7 +40,13 @@ const GuideList: React.FC<Props> = ({ className, guides }) => {
4040 return include && selectedTags . some ( ( tag ) => guide . tags ?. includes ( tag ) )
4141 } )
4242
43- return (
43+ return filteredGuides . length === 0 ? (
44+ < div className = { className } >
45+ < p className = "text-lg" >
46+ No guides found. Please try selecting different filters.
47+ </ p >
48+ </ div >
49+ ) : (
4450 < ul className = { cn ( 'space-y-4' , className ) } >
4551 { filteredGuides . map ( ( guide ) => (
4652 < li key = { guide . slug } >
Original file line number Diff line number Diff line change 1+ import React from 'react'
2+ import {
3+ Dialog ,
4+ DialogClose ,
5+ DialogContent ,
6+ DialogDescription ,
7+ DialogFooter ,
8+ DialogHeader ,
9+ DialogTitle ,
10+ DialogTrigger ,
11+ } from '../ui/dialog'
12+ import { Button } from '../ui/button'
13+ import { AdjustmentsHorizontalIcon } from '@heroicons/react/24/outline'
14+ import { GuideFilters } from './GuideFilters'
15+
16+ interface GuideMobileFiltersProps {
17+ allTags : string [ ]
18+ }
19+
20+ const GuideMobileFilters : React . FC < GuideMobileFiltersProps > = ( { allTags } ) => {
21+ return (
22+ < Dialog >
23+ < DialogTrigger asChild >
24+ < Button variant = "outline" size = "icon" >
25+ < AdjustmentsHorizontalIcon className = "h-6 w-6" />
26+ </ Button >
27+ </ DialogTrigger >
28+ < DialogContent >
29+ < DialogHeader className = "mb-10" >
30+ < DialogTitle className = "sr-only" > Set Filters</ DialogTitle >
31+ </ DialogHeader >
32+ < GuideFilters allTags = { allTags } />
33+ < DialogClose asChild >
34+ < Button className = "mt-10 w-full" > Apply</ Button >
35+ </ DialogClose >
36+ </ DialogContent >
37+ </ Dialog >
38+ )
39+ }
40+
41+ export default GuideMobileFilters
Original file line number Diff line number Diff line change @@ -3,29 +3,35 @@ import React, { Suspense } from 'react'
33
44import { GuideFilters } from './GuideFilters'
55import GuideList from './GuideList'
6+ import { Button } from '../ui/button'
7+ import { AdjustmentsHorizontalIcon } from '@heroicons/react/24/outline'
8+ import GuideMobileFilters from './GuideMobileFilters'
69
710interface Props {
811 guides : Doc [ ]
912 allTags : string [ ]
1013}
1114
12- // TODO change this to use server actions
1315const GuidePage : React . FC < Props > = ( { guides, allTags } ) => {
1416 return (
15- < div >
16- < div className = "gap-x-4 lg:grid lg:grid-cols-[280px,1fr]" >
17- < div className = "border-r" >
18- < aside
19- aria-label = "Sidebar"
20- className = "sticky top-[calc(var(--header-height)+1px+2rem)] mt-10 hidden max-h-[calc(100vh-var(--header-height)-3rem)] w-80 space-y-10 overflow-y-auto lg:block"
21- >
22- < GuideFilters allTags = { allTags } />
23- </ aside >
24- </ div >
25- < Suspense >
26- < GuideList guides = { guides } className = "relative mx-8 mt-10 w-full" />
27- </ Suspense >
17+ < div className = "gap-x-4 lg:grid lg:grid-cols-[280px,1fr]" >
18+ < div className = "hidden border-r pb-10 lg:block" >
19+ < aside
20+ aria-label = "Sidebar"
21+ className = "sticky top-[calc(var(--header-height)+1px+2rem)] mt-10 max-h-[calc(100vh-var(--header-height)-3rem)] w-80 space-y-10 overflow-y-auto"
22+ >
23+ < GuideFilters allTags = { allTags } />
24+ </ aside >
2825 </ div >
26+ < div className = "relative -top-5 lg:hidden" >
27+ < GuideMobileFilters allTags = { allTags } />
28+ </ div >
29+ < Suspense >
30+ < GuideList
31+ guides = { guides }
32+ className = "relative mx-2 my-4 w-full lg:mx-8 lg:my-10"
33+ />
34+ </ Suspense >
2935 </ div >
3036 )
3137}
You can’t perform that action at this time.
0 commit comments