Skip to content

Commit 9260cd8

Browse files
committed
rm redundant RTL logic from translation banners
1 parent a5c36ca commit 9260cd8

File tree

3 files changed

+3
-18
lines changed

3 files changed

+3
-18
lines changed

src/components/TranslationBanner.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ import Emoji from "./Emoji"
99

1010
export interface IProps {
1111
shouldShow: boolean
12-
isPageRightToLeft: boolean
1312
originalPagePath: string
1413
isPageContentEnglish: boolean
1514
}
1615

1716
const TranslationBanner: React.FC<IProps> = ({
1817
shouldShow,
19-
isPageRightToLeft,
2018
originalPagePath,
2119
isPageContentEnglish,
2220
}) => {
@@ -60,7 +58,6 @@ const TranslationBanner: React.FC<IProps> = ({
6058
>
6159
<Flex
6260
flexDirection="column"
63-
alignItems={isPageRightToLeft ? "flex-end" : "flex-start"}
6461
m={4}
6562
mt={{ base: 10, sm: 4 }}
6663
>
@@ -115,7 +112,7 @@ const TranslationBanner: React.FC<IProps> = ({
115112
<CloseButton
116113
position="absolute"
117114
top="0"
118-
insetInlineEnd={isPageRightToLeft ? "auto" : 0}
115+
insetInlineEnd="0"
119116
margin={2}
120117
color="secondary"
121118
_hover={{

src/components/TranslationBannerLegal.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ import Translation from "./Translation"
1414

1515
export interface IProps {
1616
shouldShow: boolean
17-
isPageRightToLeft: boolean
1817
originalPagePath: string
1918
}
2019

2120
const TranslationBannerLegal: React.FC<IProps> = ({
2221
shouldShow,
2322
originalPagePath,
24-
isPageRightToLeft,
2523
}) => {
2624
// Default to isOpen being false, and let the useEffect set this.
2725
const [isOpen, setIsOpen] = useState(false)
@@ -61,12 +59,7 @@ const TranslationBannerLegal: React.FC<IProps> = ({
6159
md: "rgba(0, 0, 0, 0.16) 0px 2px 4px 0px",
6260
}}
6361
>
64-
<Flex
65-
direction="column"
66-
align={isPageRightToLeft ? "flex-end" : "flex-start"}
67-
m={4}
68-
mt={{ base: 10, sm: 4 }}
69-
>
62+
<Flex direction="column" m={4} mt={{ base: 10, sm: 4 }}>
7063
<Flex
7164
align={{ base: "flex-start", sm: "center" }}
7265
flexDirection={{ base: "column-reverse", sm: "row" }}
@@ -111,7 +104,7 @@ const TranslationBannerLegal: React.FC<IProps> = ({
111104
<CloseButton
112105
position="absolute"
113106
top={0}
114-
insetInlineEnd={isPageRightToLeft ? "auto" : 0}
107+
insetInlineEnd="0"
115108
margin={4}
116109
color="secondary"
117110
_hover={{

src/layouts/RootLayout.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { join } from "path"
33
import { useRouter } from "next/router"
44
import { Container } from "@chakra-ui/react"
55

6-
import { Lang } from "@/lib/types"
76
import { Root } from "@/lib/interfaces"
87

98
import FeedbackWidget from "@/components/FeedbackWidget"
@@ -13,7 +12,6 @@ import TranslationBanner from "@/components/TranslationBanner"
1312
import TranslationBannerLegal from "@/components/TranslationBannerLegal"
1413

1514
import { toPosixPath } from "@/lib/utils/relativePath"
16-
import { isLangRightToLeft } from "@/lib/utils/translations"
1715

1816
import { DEFAULT_LOCALE } from "@/lib/constants"
1917

@@ -40,7 +38,6 @@ export const RootLayout = ({
4038
(isPageTranslationOutdated ||
4139
(contentNotTranslated && !isPageLanguageEnglish)) &&
4240
!isLegal
43-
const isPageRightToLeft = isLangRightToLeft(locale as Lang)
4441
const originalPagePath = toPosixPath(join(DEFAULT_LOCALE, asPath))
4542

4643
return (
@@ -50,13 +47,11 @@ export const RootLayout = ({
5047
<TranslationBanner
5148
shouldShow={shouldShowTranslationBanner}
5249
isPageContentEnglish={contentNotTranslated}
53-
isPageRightToLeft={isPageRightToLeft}
5450
originalPagePath={originalPagePath}
5551
/>
5652

5753
<TranslationBannerLegal
5854
shouldShow={isLegal}
59-
isPageRightToLeft={isPageRightToLeft}
6055
originalPagePath={originalPagePath}
6156
/>
6257

0 commit comments

Comments
 (0)