File tree Expand file tree Collapse file tree 4 files changed +45
-48
lines changed Expand file tree Collapse file tree 4 files changed +45
-48
lines changed Original file line number Diff line number Diff line change 1
1
import { Image } from "@/components/Image"
2
- import Link from "@/components/ui/Link "
2
+ import { Card } from "@/components/ui/card "
3
3
import { Tag } from "@/components/ui/tag"
4
4
5
5
import { cn } from "@/lib/utils/cn"
6
6
7
7
import type { VideoCourse } from "../types"
8
8
9
- type BuildCardProps = {
9
+ type VideoCourseCardProps = {
10
10
course : VideoCourse
11
11
className ?: string
12
12
}
13
13
14
- const VideoCourseCard = ( { course, className } : BuildCardProps ) => (
15
- < Link
14
+ const VideoCourseCard = ( { course, className } : VideoCourseCardProps ) => (
15
+ < Card
16
16
href = { course . href }
17
- className = { cn (
18
- "group flex h-full w-fit flex-col gap-4 rounded-4xl no-underline" ,
19
- className
20
- ) }
21
- hideArrow
17
+ className = { cn ( "group h-full w-fit rounded-4xl no-underline" , className ) }
22
18
>
23
19
< div className = "h-fit w-full overflow-hidden rounded-2xl" >
24
20
< Image
@@ -32,16 +28,17 @@ const VideoCourseCard = ({ course, className }: BuildCardProps) => (
32
28
< Tag
33
29
status = "warning"
34
30
size = "small"
35
- className = "mb-0 rounded-[4px] px-1 py-px font-bold normal-case"
31
+ className = "mb-2 mt-4 rounded-[4px] px-1 py-0 font-bold normal-case"
36
32
>
33
+ { /* // TODO: Extract intl */ }
37
34
{ Math . round ( course . hours ) } -hour course
38
35
</ Tag >
39
- < h3 className = "groupfont-bold text-lg text-body group-hover:underline" >
36
+ < h3 className = "text-lg font-bold text-body group-hover:underline" >
40
37
{ course . title }
41
38
</ h3 >
42
39
< p className = "mb-4 text-sm text-body-medium" > { course . description } </ p >
43
40
</ div >
44
- </ Link >
41
+ </ Card >
45
42
)
46
43
47
44
export default VideoCourseCard
Original file line number Diff line number Diff line change @@ -5,40 +5,21 @@ import { Swiper, SwiperSlide } from "@/components/ui/swiper"
5
5
import type { VideoCourse } from "../../types"
6
6
import VideoCourseCard from "../VideoCourseCard"
7
7
8
- import { useBreakpointValue } from "@/hooks/useBreakpointValue"
9
-
10
8
type VideoCourseSwiperProps = {
11
9
courses : VideoCourse [ ]
12
10
}
13
11
14
- const VideoCourseSwiper = ( { courses } : VideoCourseSwiperProps ) => {
15
- const slidesPerView = useBreakpointValue ( {
16
- base : 1.25 ,
17
- sm : 1.6 ,
18
- md : 2.7 ,
19
- lg : 4.4 ,
20
- xl : 5 ,
21
- } )
22
- const spaceBetween = useBreakpointValue ( {
23
- base : 16 ,
24
- sm : 12 ,
25
- md : 16 ,
26
- lg : 24 ,
27
- xl : 32 ,
28
- } )
29
-
30
- return (
31
- < Swiper spaceBetween = { spaceBetween } slidesPerView = { slidesPerView } >
32
- { courses . map ( ( course , idx ) => (
33
- < SwiperSlide
34
- key = { idx }
35
- className = "max-xl:first:ms-8 max-xl:[&:last-child_div]:pe-16"
36
- >
37
- < VideoCourseCard course = { course } />
38
- </ SwiperSlide >
39
- ) ) }
40
- </ Swiper >
41
- )
42
- }
12
+ const VideoCourseSwiper = ( { courses } : VideoCourseSwiperProps ) => (
13
+ < Swiper spaceBetween = { 16 } slidesPerView = { 1.25 } >
14
+ { courses . map ( ( course , idx ) => (
15
+ < SwiperSlide
16
+ key = { idx }
17
+ className = "max-xl://[&:last-child_div]:pe-16 max-2xl:first:ms-8 max-2xl:last:pe-16"
18
+ >
19
+ < VideoCourseCard course = { course } />
20
+ </ SwiperSlide >
21
+ ) ) }
22
+ </ Swiper >
23
+ )
43
24
44
25
export default VideoCourseSwiper
Original file line number Diff line number Diff line change 1
1
import { SkeletonCardGrid } from "@/components/ui/skeleton"
2
2
3
- const Loading = ( ) => < SkeletonCardGrid />
3
+ const Loading = ( ) => (
4
+ < div className = "px-8" >
5
+ < SkeletonCardGrid />
6
+ </ div >
7
+ )
4
8
5
9
export default Loading
Original file line number Diff line number Diff line change @@ -45,6 +45,21 @@ const RightColumn = (props: ChildOnlyProp) => (
45
45
< div className = "mb-6 me-0 w-full flex-1 basis-1/3" { ...props } />
46
46
)
47
47
48
+ const Scroller = ( {
49
+ className,
50
+ ...props
51
+ } : React . HTMLAttributes < HTMLDivElement > ) => {
52
+ return (
53
+ < div
54
+ className = { cn (
55
+ "relative flex w-screen gap-6 overflow-x-auto pb-2 max-2xl:-mx-8 max-2xl:px-8 max-sm:hidden lg:gap-8 2xl:w-full" ,
56
+ className
57
+ ) }
58
+ { ...props }
59
+ />
60
+ )
61
+ }
62
+
48
63
const DevelopersPage = async ( {
49
64
params,
50
65
} : {
@@ -243,20 +258,20 @@ const DevelopersPage = async ({
243
258
</ Card >
244
259
</ Section >
245
260
246
- < Section id = "courses" className = "space-y-4 py-10 md:py-12 " >
261
+ < Section id = "courses" className = "space-y-4 py-6 " >
247
262
< h2 > { t ( "page-developers-video-courses-title" ) } </ h2 >
248
263
< p > { t ( "page-developers-video-courses-desc" ) } </ p >
249
264
250
265
{ /* DESKTOP */ }
251
- < div className = "flex w-screen gap-6 overflow-x-auto max-2xl:-mx-8 max-2xl:pe-8 max-sm:hidden lg:gap-8 2xl:w-full" >
266
+ < Scroller >
252
267
{ courses . map ( ( course , idx ) => (
253
268
< VideoCourseCard
254
269
key = { idx }
255
270
course = { course }
256
- className = "w-[20%] min -w-[240px] max-w-[271px] max-2xl:first:ms-8 "
271
+ className = "w-[20%] max -w-[271px] flex-1 max-2xl:min- w-[20rem] xl:w-full "
257
272
/>
258
273
) ) }
259
- </ div >
274
+ </ Scroller >
260
275
261
276
{ /* MOBILE */ }
262
277
< div className = "w-screen max-xl:-ms-8 sm:hidden xl:w-full" >
You can’t perform that action at this time.
0 commit comments