File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -5,21 +5,23 @@ import type { Lang } from "@/lib/types"
5
5
import { isLangRightToLeft } from "@/lib/utils/translations"
6
6
7
7
type UseDirection = {
8
- flipForRtl : "scaleX(-1)" | undefined
8
+ flipForRtl : "scaleX(-1)" | undefined // transform (deprecated)
9
+ twFlipForRtl : "-scale-x-1" | undefined // className
9
10
isRtl : boolean
10
11
direction : "ltr" | "rtl"
11
12
}
12
13
13
14
/**
14
15
* Custom hook that determines the direction and transformation for right-to-left (RTL) languages.
15
16
* @example const { flipForRtl } = useRtlFlip(); transform={flipForRtl}
16
- * @returns An object containing the CSS transformation , RTL flag, and direction.
17
+ * @returns An object containing the Tailwind className , RTL flag, and direction.
17
18
*/
18
19
export const useRtlFlip = ( ) : UseDirection => {
19
20
const { locale } = useRouter ( )
20
21
const isRtl = isLangRightToLeft ( locale as Lang )
21
22
return {
22
- flipForRtl : isRtl ? "scaleX(-1)" : undefined ,
23
+ flipForRtl : isRtl ? "scaleX(-1)" : undefined , // transform (deprecated)
24
+ twFlipForRtl : isRtl ? "-scale-x-1" : undefined , // className (preferred)
23
25
isRtl,
24
26
direction : isRtl ? "rtl" : "ltr" ,
25
27
}
You can’t perform that action at this time.
0 commit comments