Skip to content

Commit 1296e8b

Browse files
Fix for arabic translations (#179)
* solution for an arabic fix * fixed an error with locale type * Co-locate code + make it DRY + type improvements * some styles updates for arabic direction * horizontal scroll fix and style updates * small design tweak and background-image fix * background image fixes * arabic lang design fixes * Use logical properties instead of left/right everywhere Co-authored-by: Benoît Rouleau <benoit.rouleau@icloud.com>
1 parent 4382519 commit 1296e8b

13 files changed

+91
-64
lines changed

components/Blockquote.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const Blockquote = ({ children, ...props }: BlockquoteProps) => {
1010
sx={{
1111
my: Spacing.XL,
1212
p: Spacing.L_XL,
13-
borderLeft: buildBorder('Purple', '4px'),
13+
borderInlineStart: buildBorder('Purple', '4px'),
1414
bg: 'Purple8',
1515
}}
1616
{...props}

components/DocSearch.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,16 @@ export function DocSearch(props: DocSearchProps) {
7676
<Icon.Search size="14px" title="" sx={{ flexShrink: 0 }} />
7777
<Text.P14 size="14px">{props?.translations?.button?.buttonText ?? 'Search'}</Text.P14>
7878
{/* TODO: Remove `fontFamily: 'inherit'` when it's included in `@edgeandnode/components`'s global styles */}
79-
<Text.P14 as="kbd" size="14px" color="White48" sx={{ ml: 'auto', px: Spacing.M, fontFamily: 'inherit' }}>
79+
<Text.P14
80+
as="kbd"
81+
size="14px"
82+
color="White48"
83+
sx={{ marginInlineStart: 'auto', px: Spacing.M, fontFamily: 'inherit' }}
84+
>
8085
<abbr title="Command" sx={{ textDecoration: 'none' }}>
8186
8287
</abbr>
83-
<span sx={{ ml: Spacing.S }}>K</span>
88+
<span sx={{ marginInlineStart: Spacing.S }}>K</span>
8489
</Text.P14>
8590
</Flex.Row>
8691
</button>
@@ -128,8 +133,7 @@ export function DocSearch(props: DocSearchProps) {
128133
content: `''`,
129134
zIndex: 100,
130135
position: 'absolute',
131-
left: Spacing.L_XL,
132-
right: Spacing.L_XL,
136+
insetInline: Spacing.L_XL,
133137
bottom: '-1px',
134138
borderBottom: buildBorder('White16')(theme),
135139
backgroundColor: 'var(--docsearch-modal-background)',
@@ -159,8 +163,8 @@ export function DocSearch(props: DocSearchProps) {
159163
},
160164
},
161165
'.DocSearch-Cancel': {
162-
marginLeft: Spacing.L,
163-
marginRight: Spacing.S,
166+
marginInlineStart: Spacing.L,
167+
marginInlineEnd: Spacing.S,
164168
color: 'inherit',
165169
},
166170
'.DocSearch-Dropdown': {
@@ -236,26 +240,22 @@ export function DocSearch(props: DocSearchProps) {
236240
textOverflow: 'ellipsis',
237241
},
238242
'.DocSearch-Hit-action': {
239-
marginLeft: Spacing.L,
243+
marginInlineStart: Spacing.L,
240244
},
241245
'.DocSearch-HitsFooter': {
242246
display: 'none',
243247
},
244248
'.DocSearch-Footer': {
245249
position: 'fixed',
246250
bottom: 0,
247-
left: 0,
248-
right: 0,
251+
insetInline: 0,
249252
padding: Spacing.L,
250253
backgroundColor: 'transparent',
251254
boxShadow: 'none',
252255
'&::before': {
253256
content: `''`,
254257
position: 'absolute',
255-
left: 0,
256-
right: 0,
257-
top: 0,
258-
bottom: 0,
258+
inset: 0,
259259
backgroundColor: 'var(--docsearch-modal-background)',
260260
opacity: Opacity['88%'],
261261
[`@media (min-width: ${BREAKPOINT})`]: {

components/Heading.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const BaseHeading = ({ level, id, className, children, ...props }: HeadingProps)
4646
{id ? (
4747
<span
4848
sx={{
49-
ml: '0.35em',
49+
marginInlineStart: '0.35em',
5050
opacity: Opacity['0%'],
5151
[`.${rootClass}:hover &, &:focus-within`]: { opacity: Opacity['100%'] },
5252
transition: buildTransition('OPACITY'),

components/List.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const List = ({ as, children, ...props }: ListProps) => {
1818
sx={{
1919
mt: Spacing.L,
2020
mb: Spacing.L_XL,
21-
pl: Spacing.XL,
21+
paddingInlineStat: Spacing.XL,
2222
listStyleType: as === 'ol' ? 'decimal' : 'disc',
2323
'& > li': {
2424
display: 'list-item',

components/NavTree.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
IconProps,
1010
Spacing,
1111
buildTransition,
12+
Locale,
1213
} from '@edgeandnode/components'
1314
import { keyframes } from '@emotion/react'
1415
import { SxProp } from 'theme-ui'
@@ -88,7 +89,7 @@ const NavTreeItem = ({
8889
size="12px"
8990
sx={{
9091
position: 'absolute',
91-
left: Spacing.S,
92+
insetInlineStart: Spacing.S,
9293
top: 0,
9394
bottom: 0,
9495
my: 'auto',
@@ -130,7 +131,7 @@ const NavTreeGroupHeading = ({ children, buttonProps = {}, ...props }: NavTreeGr
130131
<Collapsible.Trigger
131132
sx={{
132133
width: '100%',
133-
px: Spacing.L_XL,
134+
paddingInline: Spacing.L_XL,
134135
py: Spacing.M_L,
135136
color: context.open || context.active ? 'White88' : 'White64',
136137
'&:hover': { color: 'White' },
@@ -170,7 +171,7 @@ const NavTreeGroupContent = ({ children, ...props }: NavTreeGroupContentProps) =
170171
}}
171172
{...props}
172173
>
173-
<ul sx={{ pl: Spacing.L }}>{children}</ul>
174+
<ul sx={{ paddingInlineStart: Spacing.L }}>{children}</ul>
174175
</Collapsible.Content>
175176
)
176177
}
@@ -185,7 +186,7 @@ const NavTreeDivider = (props: NavTreeDividerProps) => {
185186

186187
const NavTreeHeading = ({ children, ...props }: NavTreeHeadingProps) => {
187188
return (
188-
<li sx={{ mt: Spacing.XL, mb: Spacing.M_L, pl: Spacing.L_XL }} {...props}>
189+
<li sx={{ mt: Spacing.XL, mb: Spacing.M_L, paddingInlineStart: Spacing.L_XL }} {...props}>
189190
<Text.C12 color="White48">{children}</Text.C12>
190191
</li>
191192
)

layout/MDXLayout.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ export const MDXLayout = ({ pagePath, navItems, frontmatter, outline, children }
147147
sx={{
148148
display: ['none', null, null, 'block'],
149149
mt: 'calc(-1 * var(--gds-header-height) * var(--gds-header-fixed))',
150-
ml: '-8px',
151-
mr: '24px',
150+
marginInlineStart: '-8px',
151+
marginInlineEnd: '24px',
152152
}}
153153
>
154154
<MDXLayoutNav />
@@ -187,8 +187,8 @@ export const MDXLayout = ({ pagePath, navItems, frontmatter, outline, children }
187187
sx={{
188188
display: ['none', null, null, 'block'],
189189
mt: 'calc(-1 * var(--gds-header-height) * var(--gds-header-fixed))',
190-
ml: '40px',
191-
mr: '-8px',
190+
marginInlineStart: '40px',
191+
marginInlineEnd: '-8px',
192192
}}
193193
>
194194
<MDXLayoutOutline />

layout/MDXLayoutNav.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const DesktopWrapper = ({ children }: PropsWithChildren<{}>) => {
3535
position: 'sticky',
3636
top: 0,
3737
maxHeight: '100vh',
38-
pr: Spacing.L_XL,
38+
paddingInlineEnd: Spacing.L_XL,
3939
pt: Spacing.XL,
4040
pb: Spacing.L,
4141
overflowY: 'auto',
@@ -172,7 +172,10 @@ export const MDXLayoutNav = ({ mobile = false }: { mobile?: boolean }) => {
172172
if ('children' in navItem) {
173173
return (
174174
<NavTree.Group active={currentPage?.path.startsWith(navItem.path)}>
175-
<NavTree.Group.Heading sx={mobile ? { py: 0 } : {}} buttonProps={{ sx: mobile ? {} : { pr: 0 } }}>
175+
<NavTree.Group.Heading
176+
sx={mobile ? { py: 0 } : {}}
177+
buttonProps={{ sx: mobile ? {} : { paddingInlineEnd: 0 } }}
178+
>
176179
{navItem.title}
177180
</NavTree.Group.Heading>
178181
<NavTree.Group.Content>
@@ -182,7 +185,7 @@ export const MDXLayoutNav = ({ mobile = false }: { mobile?: boolean }) => {
182185
href={childNavItem.path}
183186
active={currentPage?.path === childNavItem.path}
184187
sx={mobile ? { py: 0 } : {}}
185-
linkProps={{ sx: mobile ? {} : { pr: 0 } }}
188+
linkProps={{ sx: mobile ? {} : { paddingInlineEnd: 0 } }}
186189
>
187190
{childNavItem.title}
188191
</NavTree.Item>
@@ -196,8 +199,8 @@ export const MDXLayoutNav = ({ mobile = false }: { mobile?: boolean }) => {
196199
href={navItem.path}
197200
active={currentPage?.path === navItem.path}
198201
sx={mobile ? { py: 0 } : {}}
199-
linkProps={{ sx: mobile ? {} : { pr: 0 } }}
200-
diamondProps={{ sx: mobile ? { left: '6px' } : {} }}
202+
linkProps={{ sx: mobile ? {} : { paddingInlineEnd: 0 } }}
203+
diamondProps={{ sx: mobile ? { insetInlineStart: '6px' } : {} }}
201204
>
202205
{navItem.title}
203206
</NavTree.Item>

layout/MDXLayoutOutline.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const MDXLayoutOutline = () => {
3737
<EditPageLink />
3838
</Flex.Row>
3939
<NewGDSDivider sx={{ my: Spacing.XL }} />
40-
<nav sx={{ pr: '16px' }}>
40+
<nav sx={{ paddingInlineEnd: '16px' }}>
4141
<Text.C10 as="header" color="White64" sx={{ mb: Spacing.M_L }}>
4242
{t('global.pageSections')}
4343
</Text.C10>
@@ -52,7 +52,7 @@ export const MDXLayoutOutline = () => {
5252
href={`#${outlineItem.id}`}
5353
sx={{
5454
display: 'block',
55-
pl: `${8 * Math.max(0, outlineItem.level - 2)}px`,
55+
paddingInlineStart: `${8 * Math.max(0, outlineItem.level - 2)}px`,
5656
py: '6px',
5757
color: outlineItem.id === highlightedOutlineItemId ? 'White88' : undefined,
5858
'&:hover': { color: 'White' },

layout/MDXLayoutPagination.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ export const MDXLayoutPagination = () => {
2020
sx={{
2121
display: 'block',
2222
py: Spacing.L_XL,
23-
pl: [0, null, Spacing.L_XL],
24-
pr: Spacing.M_L,
23+
paddingInlineStart: [0, null, Spacing.L_XL],
24+
paddingInlineEnd: Spacing.M_L,
2525
color: 'White64',
2626
'&:hover': { color: 'White', textShadow: buildShadow('M') },
2727
transition: buildTransition(),
2828
}}
2929
>
30-
<Flex.Column align="start" gap={Spacing.S} sx={{ textAlign: 'left' }}>
30+
<Flex.Column align="start" gap={Spacing.S} sx={{ textAlign: 'start' }}>
3131
<Flex.Row align="center" gap={Spacing.S}>
3232
<Icon.ArrowLeft title="" size="12px" />
3333
<Text.C10>{t('global.previous')}</Text.C10>
@@ -58,14 +58,14 @@ export const MDXLayoutPagination = () => {
5858
sx={{
5959
display: 'block',
6060
py: Spacing.L_XL,
61-
pl: Spacing.M_L,
62-
pr: [0, null, Spacing.L_XL],
61+
paddingInlineStart: Spacing.M_L,
62+
paddingInlineEnd: [0, null, Spacing.L_XL],
6363
color: 'White64',
6464
'&:hover': { color: 'White', textShadow: buildShadow('M') },
6565
transition: buildTransition(),
6666
}}
6767
>
68-
<Flex.Column align="end" gap={Spacing.S} sx={{ textAlign: 'right' }}>
68+
<Flex.Column align="end" gap={Spacing.S} sx={{ textAlign: 'end' }}>
6969
<Flex.Row align="center" gap={Spacing.S}>
7070
<Text.C10>{t('global.next')}</Text.C10>
7171
<Icon.ArrowRight title="" size="12px" />

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"dependencies": {
2020
"@docsearch/react": "^3.1.0",
21-
"@edgeandnode/components": "^22.11.2",
21+
"@edgeandnode/components": "^22.11.4",
2222
"@emotion/react": "^11.9.3",
2323
"@mdx-js/loader": "^2.1.2",
2424
"@mdx-js/react": "^2.1.2",

0 commit comments

Comments
 (0)