This repository has been archived by the owner on Feb 25, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Issue #49
- Loading branch information
Showing
6 changed files
with
140 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Link } from 'react-router'; | ||
import { translate } from 'react-i18next'; | ||
import Col from 'react-bootstrap/lib/Col'; | ||
import Grid from 'react-bootstrap/lib/Grid'; | ||
import MenuItem from 'react-bootstrap/lib/MenuItem'; | ||
import Nav from 'react-bootstrap/lib/Nav'; | ||
import Navbar from 'react-bootstrap/lib/Navbar'; | ||
import NavDropdown from 'react-bootstrap/lib/NavDropdown'; | ||
import Row from 'react-bootstrap/lib/Row'; | ||
|
||
const languages = { | ||
ar: 'Argentina', | ||
ca: 'Catalan', | ||
cn: '中国语文', | ||
de: 'Deutsch', | ||
en: 'English', | ||
es: 'Español', | ||
fr: 'Français', | ||
it: 'Italiano', | ||
ko: '한국말', | ||
lv: 'Latviešu', | ||
pl: 'Język polski', | ||
pt: 'Português', | ||
'pt-BR': 'Português brasileiro', | ||
ru: 'Русский', | ||
ua: 'українська мова', | ||
zh: '中國語文', | ||
}; | ||
|
||
const renderLocaleEntry = (locale, toggle) => { | ||
if ('cimode' === locale) { | ||
return null; | ||
} | ||
|
||
const name = languages[locale]; | ||
|
||
return ( | ||
<MenuItem key={locale} onClick={() => toggle(locale)}>{name}</MenuItem> | ||
); | ||
}; | ||
|
||
const AnonymousLayout = ({ t, i18n, children }) => { | ||
const toggle = lng => i18n.changeLanguage(lng); | ||
const CurrentLang = languages[i18n.language || 'en']; | ||
|
||
return ( | ||
<div> | ||
<Navbar inverse fixedTop fluid collapseOnSelect> | ||
<Navbar.Header> | ||
<Navbar.Brand> | ||
<Link to="/">{t('Recalbox Manager')}</Link> | ||
</Navbar.Brand> | ||
|
||
<Nav pullRight> | ||
<NavDropdown title={CurrentLang} id="language-switcher" | ||
className="pull-right locale-switcher"> | ||
{i18n.options.whitelist.map(x => renderLocaleEntry(x, toggle))} | ||
</NavDropdown> | ||
</Nav> | ||
</Navbar.Header> | ||
</Navbar> | ||
|
||
<Grid fluid> | ||
<Row> | ||
<Col sm={12} className="main"> | ||
{children} | ||
</Col> | ||
</Row> | ||
</Grid> | ||
</div> | ||
); | ||
}; | ||
|
||
AnonymousLayout.propTypes = { | ||
t: PropTypes.func.isRequired, | ||
i18n: PropTypes.object.isRequired, | ||
children: PropTypes.element.isRequired, | ||
}; | ||
|
||
export default translate()(AnonymousLayout); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React, { Component } from 'react'; | ||
import Login from './Login'; | ||
|
||
class LoginContainer extends Component { | ||
render() { | ||
return ( | ||
<Login /> | ||
); | ||
} | ||
} | ||
|
||
export default LoginContainer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from 'react'; | ||
|
||
const Login = () => ( | ||
<div>IOKOK</div> | ||
); | ||
|
||
export default Login; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters