Skip to content

Commit 206da9c

Browse files
authored
Merge pull request #15542 from ethereum/roadmap-rtl-patch
fix(temp): roadmap release carousel on RTL pages
2 parents 983c845 + 5232db6 commit 206da9c

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

app/[locale]/roadmap/_components/ReleaseCarousel.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"use client"
22

3+
// TODO: Extract intl strings
4+
// TODO: Fix RTL compatibility; currenly forced to LTR flow
35
import { useCallback, useEffect, useMemo, useState } from "react"
46
import { useLocale } from "next-intl"
57

@@ -89,7 +91,7 @@ const ReleaseCarousel = () => {
8991
}
9092

9193
return (
92-
<div className="w-full max-w-[100vw] overflow-hidden">
94+
<div className="w-full max-w-[100vw] overflow-hidden" dir="ltr">
9395
<div className="mx-auto w-full max-w-screen-2xl px-4 sm:px-6">
9496
<div className="w-full rounded-2xl bg-background-highlight py-6">
9597
<div className="flex flex-col gap-6">
@@ -100,6 +102,7 @@ const ReleaseCarousel = () => {
100102
opts={{
101103
align: "center",
102104
containScroll: false,
105+
direction: "ltr",
103106
loop: false,
104107
startIndex,
105108
}}
@@ -211,6 +214,7 @@ const ReleaseCarousel = () => {
211214
opts={{
212215
align: "center",
213216
containScroll: false,
217+
direction: "ltr",
214218
loop: false,
215219
startIndex,
216220
}}

src/components/ui/carousel.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
// TODO: Fix RTL compatibility
2+
13
import * as React from "react"
24
import useEmblaCarousel, {
35
type UseEmblaCarouselType,
46
} from "embla-carousel-react"
7+
import { MdChevronLeft, MdChevronRight } from "react-icons/md"
58

6-
import { ChevronNext, ChevronPrev } from "@/components/Chevron"
79
import { Button } from "@/components/ui/buttons/Button"
810

911
import { cn } from "@/lib/utils/cn"
@@ -207,15 +209,15 @@ const CarouselPrevious = React.forwardRef<
207209
className={cn(
208210
"absolute h-8 w-8 rounded-full",
209211
orientation === "horizontal"
210-
? "left-5 top-1/2 -translate-y-1/2"
211-
: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
212+
? "start-5 top-1/2 -translate-y-1/2"
213+
: "-top-12 start-1/2 -translate-x-1/2 rotate-90",
212214
className
213215
)}
214216
disabled={!canScrollPrev}
215217
onClick={scrollPrev}
216218
{...props}
217219
>
218-
<ChevronPrev className="h-8 w-8" />
220+
<MdChevronLeft className="h-8 w-8" />
219221
<span className="sr-only">Previous slide</span>
220222
</Button>
221223
)
@@ -236,15 +238,15 @@ const CarouselNext = React.forwardRef<
236238
className={cn(
237239
"absolute h-8 w-8 rounded-full",
238240
orientation === "horizontal"
239-
? "right-5 top-1/2 -translate-y-1/2"
240-
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
241+
? "end-5 top-1/2 -translate-y-1/2"
242+
: "-bottom-12 start-1/2 -translate-x-1/2 rotate-90",
241243
className
242244
)}
243245
disabled={!canScrollNext}
244246
onClick={scrollNext}
245247
{...props}
246248
>
247-
<ChevronNext className="h-8 w-8" />
249+
<MdChevronRight className="h-8 w-8" />
248250
<span className="sr-only">Next slide</span>
249251
</Button>
250252
)

0 commit comments

Comments
 (0)