Skip to content

fix(temp): roadmap release carousel on RTL pages #15542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/[locale]/roadmap/_components/ReleaseCarousel.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"use client"

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

Expand Down Expand Up @@ -89,7 +91,7 @@ const ReleaseCarousel = () => {
}

return (
<div className="w-full max-w-[100vw] overflow-hidden">
<div className="w-full max-w-[100vw] overflow-hidden" dir="ltr">
<div className="mx-auto w-full max-w-screen-2xl px-4 sm:px-6">
<div className="w-full rounded-2xl bg-background-highlight py-6">
<div className="flex flex-col gap-6">
Expand All @@ -100,6 +102,7 @@ const ReleaseCarousel = () => {
opts={{
align: "center",
containScroll: false,
direction: "ltr",
loop: false,
startIndex,
}}
Expand Down Expand Up @@ -211,6 +214,7 @@ const ReleaseCarousel = () => {
opts={{
align: "center",
containScroll: false,
direction: "ltr",
loop: false,
startIndex,
}}
Expand Down
16 changes: 9 additions & 7 deletions src/components/ui/carousel.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// TODO: Fix RTL compatibility

import * as React from "react"
import useEmblaCarousel, {
type UseEmblaCarouselType,
} from "embla-carousel-react"
import { MdChevronLeft, MdChevronRight } from "react-icons/md"

import { ChevronNext, ChevronPrev } from "@/components/Chevron"
import { Button } from "@/components/ui/buttons/Button"

import { cn } from "@/lib/utils/cn"
Expand Down Expand Up @@ -207,15 +209,15 @@ const CarouselPrevious = React.forwardRef<
className={cn(
"absolute h-8 w-8 rounded-full",
orientation === "horizontal"
? "left-5 top-1/2 -translate-y-1/2"
: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
? "start-5 top-1/2 -translate-y-1/2"
: "-top-12 start-1/2 -translate-x-1/2 rotate-90",
className
)}
disabled={!canScrollPrev}
onClick={scrollPrev}
{...props}
>
<ChevronPrev className="h-8 w-8" />
<MdChevronLeft className="h-8 w-8" />
<span className="sr-only">Previous slide</span>
</Button>
)
Expand All @@ -236,15 +238,15 @@ const CarouselNext = React.forwardRef<
className={cn(
"absolute h-8 w-8 rounded-full",
orientation === "horizontal"
? "right-5 top-1/2 -translate-y-1/2"
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
? "end-5 top-1/2 -translate-y-1/2"
: "-bottom-12 start-1/2 -translate-x-1/2 rotate-90",
className
)}
disabled={!canScrollNext}
onClick={scrollNext}
{...props}
>
<ChevronNext className="h-8 w-8" />
<MdChevronRight className="h-8 w-8" />
<span className="sr-only">Next slide</span>
</Button>
)
Expand Down