Skip to content

Commit dcf8442

Browse files
authored
Merge pull request #8 from asantarissy/rtl-support
RTL Support
2 parents cd6ca87 + b00486f commit dcf8442

File tree

15 files changed

+84
-72
lines changed

15 files changed

+84
-72
lines changed

src/components/ButtonLink/ButtonLink.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ const ButtonLink = ({children, type, ...rest}) => {
3939
return (
4040
<Link {...rest} css={[style, typeStyle]}>
4141
{children}
42-
{type === 'secondary' && <ArrowSvg cssProps={{marginLeft: 10}} />}
42+
{type === 'secondary' && (
43+
<ArrowSvg cssProps={{marginRight: 10, transform: 'rotate(180deg)'}} />
44+
)}
4345
</Link>
4446
);
4547
};

src/components/CodeEditor/CodeEditor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class CodeEditor extends Component {
7171
return (
7272
<LiveProvider code={showJSX ? code : compiledES6} mountStylesheet={false}>
7373
<div
74+
dir="ltr"
7475
css={{
7576
[media.greaterThan('medium')]: {
7677
display: 'flex',

src/components/CodeExample/CodeExample.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class CodeExample extends Component {
4747

4848
'& p': {
4949
marginTop: 15,
50-
marginRight: 40,
50+
marginLeft: 40,
5151
lineHeight: 1.7,
5252

5353
[media.greaterThan('xlarge')]: {

src/components/Layout/Layout.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ class Template extends Component<Props> {
3939
display: 'flex',
4040
flexDirection: 'column',
4141
minHeight: 'calc(100vh - 40px)',
42-
}}>
42+
}}
43+
dir="rtl">
4344
<Header location={location} />
4445
<Flex
4546
direction="column"

src/components/LayoutFooter/ExternalFooterLink.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const ExternalFooterLink = ({children, href, target, rel}: Props) => (
3434
cssProps={{
3535
verticalAlign: -2,
3636
display: 'inline-block',
37-
marginLeft: 5,
37+
marginRight: 5,
3838
color: colors.subtle,
3939
}}
4040
/>

src/components/LayoutFooter/Footer.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import ossLogoPng from 'images/oss_logo.png';
1818

1919
const Footer = ({layoutHasSidebar = false}: {layoutHasSidebar: boolean}) => (
2020
<footer
21+
dir="rtl"
2122
css={{
2223
backgroundColor: colors.darker,
2324
color: colors.white,
@@ -36,14 +37,14 @@ const Footer = ({layoutHasSidebar = false}: {layoutHasSidebar: boolean}) => (
3637
flexWrap: 'wrap',
3738

3839
[media.between('small', 'medium')]: {
39-
paddingRight: layoutHasSidebar ? 240 : null,
40+
paddingLeft: layoutHasSidebar ? 240 : null,
4041
},
4142

4243
[media.between('large', 'largerSidebar')]: {
43-
paddingRight: layoutHasSidebar ? 280 : null,
44+
paddingLeft: layoutHasSidebar ? 280 : null,
4445
},
4546
[media.between('largerSidebar', 'sidebarFixed', true)]: {
46-
paddingRight: layoutHasSidebar ? 380 : null,
47+
paddingLeft: layoutHasSidebar ? 380 : null,
4748
},
4849
}}>
4950
<div
@@ -56,7 +57,7 @@ const Footer = ({layoutHasSidebar = false}: {layoutHasSidebar: boolean}) => (
5657
},
5758
[media.greaterThan('xlarge')]: {
5859
width: 'calc(100% / 3 * 2)',
59-
paddingLeft: 40,
60+
paddingRight: 40,
6061
},
6162
}}>
6263
<FooterNav layoutHasSidebar={layoutHasSidebar}>
@@ -143,9 +144,11 @@ const Footer = ({layoutHasSidebar = false}: {layoutHasSidebar: boolean}) => (
143144
</FooterNav>
144145
</div>
145146
<section
147+
dir="ltr"
146148
css={{
147149
paddingTop: 40,
148150
display: 'block !important', // Override 'Installation' <style> specifics
151+
paddingLeft: 40,
149152

150153
[media.greaterThan('xlarge')]: {
151154
width: 'calc(100% / 3)',

src/components/LayoutHeader/DocSearch.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class DocSearch extends Component<{}, State> {
4949
justifyContent: 'flex-end',
5050
},
5151
[media.lessThan('large')]: {
52-
marginRight: 10,
52+
marginLeft: 10,
5353
},
5454
[media.between('small', 'medium')]: {
5555
width: 'calc(100% / 3)',
@@ -62,6 +62,7 @@ class DocSearch extends Component<{}, State> {
6262
},
6363
}}>
6464
<input
65+
dir="rtl"
6566
css={{
6667
appearance: 'none',
6768
background: 'transparent',
@@ -71,12 +72,12 @@ class DocSearch extends Component<{}, State> {
7172
fontWeight: 300,
7273
fontFamily: 'inherit',
7374
position: 'relative',
74-
padding: '5px 5px 5px 29px',
75+
padding: '5px 29px 5px 5px',
7576
backgroundImage: 'url(/search.svg)',
7677
backgroundSize: '16px 16px',
7778
backgroundRepeat: 'no-repeat',
7879
backgroundPositionY: 'center',
79-
backgroundPositionX: '5px',
80+
backgroundPositionX: '98%',
8081

8182
':focus': {
8283
outline: 0,
@@ -93,10 +94,10 @@ class DocSearch extends Component<{}, State> {
9394
[media.lessThan('small')]: {
9495
width: '16px',
9596
transition: 'width 0.2s ease, padding 0.2s ease',
96-
paddingLeft: '16px',
97+
paddingRight: '16px',
9798

9899
':focus': {
99-
paddingLeft: '29px',
100+
paddingRight: '29px',
100101
width: '8rem',
101102
outline: 'none',
102103
},

src/components/LayoutHeader/Header.js

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import logoSvg from 'icons/logo.svg';
1818

1919
const Header = ({location}: {location: Location}) => (
2020
<header
21+
dir="rtl"
2122
css={{
2223
backgroundColor: colors.darker,
2324
color: colors.white,
@@ -62,7 +63,6 @@ const Header = ({location}: {location: Location}) => (
6263
},
6364
}}
6465
to="/">
65-
<img src={logoSvg} alt="" height="20" />
6666
<span
6767
css={{
6868
color: 'inherit',
@@ -88,6 +88,7 @@ const Header = ({location}: {location: Location}) => (
8888
}}>
8989
React
9090
</span>
91+
<img src={logoSvg} alt="" height="20" />
9192
</Link>
9293

9394
<nav
@@ -146,9 +147,10 @@ const Header = ({location}: {location: Location}) => (
146147
width: 'calc(100% / 6)',
147148
},
148149
}}>
149-
<Link
150+
<a
150151
css={{
151152
padding: '5px 10px',
153+
marginRight: 10,
152154
whiteSpace: 'nowrap',
153155
...fonts.small,
154156

@@ -162,13 +164,21 @@ const Header = ({location}: {location: Location}) => (
162164
borderRadius: 15,
163165
},
164166
}}
165-
to="/versions">
166-
v{version}
167-
</Link>
168-
<a
167+
href="https://github.com/facebook/react/"
168+
target="_blank"
169+
rel="noopener">
170+
GitHub
171+
<ExternalLinkSvg
172+
cssProps={{
173+
marginLeft: 5,
174+
verticalAlign: -2,
175+
color: colors.subtle,
176+
}}
177+
/>
178+
</a>
179+
<Link
169180
css={{
170181
padding: '5px 10px',
171-
marginLeft: 10,
172182
whiteSpace: 'nowrap',
173183
...fonts.small,
174184

@@ -182,18 +192,9 @@ const Header = ({location}: {location: Location}) => (
182192
borderRadius: 15,
183193
},
184194
}}
185-
href="https://github.com/facebook/react/"
186-
target="_blank"
187-
rel="noopener">
188-
GitHub
189-
<ExternalLinkSvg
190-
cssProps={{
191-
marginLeft: 5,
192-
verticalAlign: -2,
193-
color: colors.subtle,
194-
}}
195-
/>
196-
</a>
195+
to="/versions">
196+
v{version}
197+
</Link>
197198
</div>
198199
</div>
199200
</Container>

src/components/StickyResponsiveSidebar/StickyResponsiveSidebar.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ class StickyResponsiveSidebar extends Component<Props, State> {
7676
[media.lessThan('small')]: smallScreenSidebarStyles,
7777

7878
[media.greaterThan('medium')]: {
79-
marginRight: -999,
80-
paddingRight: 999,
79+
marginLeft: -999,
80+
paddingLeft: 999,
8181
backgroundColor: '#f7f7f7',
8282
},
8383

@@ -93,8 +93,8 @@ class StickyResponsiveSidebar extends Component<Props, State> {
9393
height: 'calc(100vh - 60px)',
9494
overflowY: 'auto',
9595
WebkitOverflowScrolling: 'touch',
96-
marginRight: -999,
97-
paddingRight: 999,
96+
marginLeft: -999,
97+
paddingLeft: 999,
9898
backgroundColor: '#f7f7f7',
9999
opacity: '1 !important',
100100
},
@@ -108,7 +108,7 @@ class StickyResponsiveSidebar extends Component<Props, State> {
108108
},
109109

110110
[media.greaterThan('sidebarFixed')]: {
111-
borderLeft: '1px solid #ececec',
111+
borderRight: '1px solid #ececec',
112112
},
113113
}}>
114114
<div
@@ -146,7 +146,7 @@ class StickyResponsiveSidebar extends Component<Props, State> {
146146
display: 'none', // gets overriden at small screen sizes
147147
cursor: 'pointer',
148148
position: 'fixed',
149-
right: 20,
149+
left: 20,
150150
zIndex: 3,
151151
borderRadius: '50%',
152152
border: '1px solid rgba(255, 255, 255, 0.1)',
@@ -184,14 +184,14 @@ class StickyResponsiveSidebar extends Component<Props, State> {
184184
<ChevronSvg
185185
size={15}
186186
cssProps={{
187-
transform: `translate(2px, ${iconOffset}px) rotate(180deg)`,
187+
transform: `translate(-2px, ${iconOffset}px) rotate(180deg)`,
188188
transition: 'transform 0.2s ease',
189189
}}
190190
/>
191191
<ChevronSvg
192192
size={15}
193193
cssProps={{
194-
transform: `translate(2px, ${0 - iconOffset}px)`,
194+
transform: `translate(-2px, ${0 - iconOffset}px)`,
195195
transition: 'transform 0.2s ease',
196196
}}
197197
/>

src/pages/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class Home extends Component {
5454
title="React &ndash; A JavaScript library for building user interfaces"
5555
ogUrl={createOgUrl('index.html')}
5656
/>
57-
<div css={{width: '100%'}}>
57+
<div dir="rtl" css={{width: '100%'}}>
5858
<header
5959
css={{
6060
backgroundColor: colors.dark,
@@ -198,23 +198,23 @@ class Home extends Component {
198198
display: 'flex',
199199
flexDirection: 'column',
200200
flex: '0 1 33%',
201-
marginLeft: 40,
201+
marginRight: 40,
202202

203203
'&:first-of-type': {
204-
marginLeft: 0,
204+
marginRight: 0,
205205

206206
[media.lessThan('medium')]: {
207-
marginLeft: 10,
207+
marginRight: 10,
208208
},
209209
},
210210

211211
[media.lessThan('medium')]: {
212212
display: 'inline-block',
213213
verticalAlign: 'top',
214-
marginLeft: 0,
214+
marginRight: 0,
215215
whiteSpace: 'normal',
216216
width: '75%',
217-
marginRight: 20,
217+
marginLeft: 20,
218218
paddingBottom: 40,
219219

220220
'&:first-of-type': {
@@ -327,17 +327,17 @@ const CtaItem = ({children, primary = false}) => (
327327
},
328328

329329
[media.greaterThan('xlarge')]: {
330-
paddingLeft: 40,
330+
paddingRight: 40,
331331
},
332332

333333
'&:first-child': {
334-
textAlign: 'right',
335-
paddingRight: 15,
334+
textAlign: 'left',
335+
paddingLeft: 15,
336336
},
337337

338338
'&:nth-child(2)': {
339339
[media.greaterThan('small')]: {
340-
paddingLeft: 15,
340+
paddingRight: 15,
341341
},
342342
},
343343
}}>

0 commit comments

Comments
 (0)