diff options
| author | Ramin <39030920+raminr77@users.noreply.github.com> | 2021-07-26 19:25:01 +0430 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-26 07:55:01 -0700 |
| commit | 3a3f950daaaf23a45b34cb57120fc4dc1ba6860b (patch) | |
| tree | 37a86ceb5291bf9eda1c6e03447809557eb93b4d /src/components/Card.js | |
| parent | a969382303b4fe7e8a1c5bf8bf21d698ec330bb7 (diff) | |
Add RTL Direction & Persian Translation (#79)
* feat: add RTL direction and persian lang
* feat: init RTL direction
* fix: style issues
Co-authored-by: Ramin <r.rezaei@digikala.com>
Diffstat (limited to 'src/components/Card.js')
| -rw-r--r-- | src/components/Card.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/components/Card.js b/src/components/Card.js index 298f968..bcb7acc 100644 --- a/src/components/Card.js +++ b/src/components/Card.js | |||
| @@ -3,7 +3,7 @@ import { useEffect, useRef, useState } from 'react'; | |||
| 3 | import { useTranslation } from 'react-i18next'; | 3 | import { useTranslation } from 'react-i18next'; |
| 4 | import './style.css'; | 4 | import './style.css'; |
| 5 | 5 | ||
| 6 | export const Card = () => { | 6 | export const Card = ({ direction = 'ltr' }) => { |
| 7 | const firstLoad = useRef(true); | 7 | const firstLoad = useRef(true); |
| 8 | const [qrvalue, setQrvalue] = useState(''); | 8 | const [qrvalue, setQrvalue] = useState(''); |
| 9 | const [network, setNetwork] = useState({ | 9 | const [network, setNetwork] = useState({ |
| @@ -64,7 +64,7 @@ export const Card = () => { | |||
| 64 | id="print-area" | 64 | id="print-area" |
| 65 | style={{ maxWidth: portrait ? '350px' : '100%' }} | 65 | style={{ maxWidth: portrait ? '350px' : '100%' }} |
| 66 | > | 66 | > |
| 67 | <h1 style={{ textAlign: portrait ? 'center' : 'left' }}> | 67 | <h1 style={{ textAlign: portrait ? 'center' : 'unset' }}> |
| 68 | {t('wifi.login')} | 68 | {t('wifi.login')} |
| 69 | </h1> | 69 | </h1> |
| 70 | 70 | ||
| @@ -74,7 +74,13 @@ export const Card = () => { | |||
| 74 | > | 74 | > |
| 75 | <QRCode | 75 | <QRCode |
| 76 | className="qrcode" | 76 | className="qrcode" |
| 77 | style={{ paddingRight: portrait ? '' : '1em' }} | 77 | style={ |
| 78 | !portrait | ||
| 79 | ? direction === 'ltr' | ||
| 80 | ? { paddingRight: '1em' } | ||
| 81 | : { paddingLeft: '1em' } | ||
| 82 | : {} | ||
| 83 | } | ||
| 78 | value={qrvalue} | 84 | value={qrvalue} |
| 79 | size={175} | 85 | size={175} |
| 80 | /> | 86 | /> |
