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