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 {
26
26
27
27
const GuideList : React . FC < Props > = ( { className, guides } ) => {
28
28
const { searchParams } = useParams ( )
29
- const selectedTags = searchParams . get ( 'tags' ) ?. split ( ',' ) || [ ]
29
+ const selectedTags = searchParams ? .get ( 'tags' ) ?. split ( ',' ) || [ ]
30
30
const { currentLanguage } = useLang ( )
31
31
const filteredGuides = guides . filter ( ( guide ) => {
32
32
let include = true
@@ -40,7 +40,13 @@ const GuideList: React.FC<Props> = ({ className, guides }) => {
40
40
return include && selectedTags . some ( ( tag ) => guide . tags ?. includes ( tag ) )
41
41
} )
42
42
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
+ ) : (
44
50
< ul className = { cn ( 'space-y-4' , className ) } >
45
51
{ filteredGuides . map ( ( guide ) => (
46
52
< 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'
3
3
4
4
import { GuideFilters } from './GuideFilters'
5
5
import GuideList from './GuideList'
6
+ import { Button } from '../ui/button'
7
+ import { AdjustmentsHorizontalIcon } from '@heroicons/react/24/outline'
8
+ import GuideMobileFilters from './GuideMobileFilters'
6
9
7
10
interface Props {
8
11
guides : Doc [ ]
9
12
allTags : string [ ]
10
13
}
11
14
12
- // TODO change this to use server actions
13
15
const GuidePage : React . FC < Props > = ( { guides, allTags } ) => {
14
16
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 >
28
25
</ 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 >
29
35
</ div >
30
36
)
31
37
}
You can’t perform that action at this time.
0 commit comments