Skip to content

Commit

Permalink
feat(user): add nav translations
Browse files Browse the repository at this point in the history
  • Loading branch information
royschut committed Jul 20, 2021
1 parent 800dfc8 commit 4f6a203
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/containers/Customer/Customer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const Account = ({ children }: Props): JSX.Element => {
country: 'England',
currency: 'Euro',
lastUserIp: 'temp',
firstName: 'Henk',
lastName: 'Peterson',
};
const update = (customer: Customer) => console.info('update', customer);

Expand Down
6 changes: 6 additions & 0 deletions src/i18n/locales/en_US/user.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"nav": {
"account": "Account",
"favorites": "Favorites",
"payments": "Payments",
"logout": "Log out"
},
"account": {
"email": "Email",
"edit_account": "Edit account",
Expand Down
6 changes: 6 additions & 0 deletions src/i18n/locales/nl_NL/user.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"nav": {
"account": "",
"favorites": "",
"payments": "",
"logout": ""
},
"account": {
"email": "",
"edit_account": "",
Expand Down
10 changes: 6 additions & 4 deletions src/screens/User/User.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { Redirect, Route, Switch } from 'react-router-dom';
import { useTranslation } from 'react-i18next';

import Customer from '../../containers/Customer/Customer';
import SubscriptionContainer from '../../containers/Subscription/Subscription';
Expand All @@ -15,6 +16,7 @@ import Exit from '../../icons/Exit';
import styles from './User.module.scss';

const User = (): JSX.Element => {
const { t } = useTranslation('user');
const breakpoint = useBreakpoint();
const isLargeScreen = breakpoint >= Breakpoint.md;

Expand All @@ -25,16 +27,16 @@ const User = (): JSX.Element => {
<div className={styles.panel}>
<ul>
<li>
<Button to="/u/my-account" label="Account" variant="text" startIcon={<AccountCircle />} className={styles.button} />
<Button to="/u/my-account" label={t('nav.account')} variant="text" startIcon={<AccountCircle />} className={styles.button} />
</li>
<li>
<Button to="/u/favorites" label="Favorites" variant="text" startIcon={<Favorite />} className={styles.button} />
<Button to="/u/favorites" label={t('nav.favorites')} variant="text" startIcon={<Favorite />} className={styles.button} />
</li>
<li>
<Button to="/u/payments" label="Payments" variant="text" startIcon={<BalanceWallet />} className={styles.button} />
<Button to="/u/payments" label={t('nav.payments')} variant="text" startIcon={<BalanceWallet />} className={styles.button} />
</li>
<li className={styles.logoutLi}>
<Button to="/u/logout" label="Log out" variant="text" startIcon={<Exit />} className={styles.button} />
<Button to="/u/logout" label={t('nav.logout')} variant="text" startIcon={<Exit />} className={styles.button} />
</li>
</ul>
</div>
Expand Down

0 comments on commit 4f6a203

Please sign in to comment.