1
0
Fork 0
mirror of https://github.com/voltbonn/profile-picture-generator.git synced 2024-12-21 23:35:05 +00:00

moved language chooser into the main app component

This commit is contained in:
thomasrosen 2021-04-29 09:50:40 +02:00
parent a47fd53927
commit a91df1b61b
2 changed files with 23 additions and 21 deletions

View file

@ -23,7 +23,7 @@ footer{
}
.locale_chooser{
margin: -8vmin 10vmin 10vmin 10vmin;
margin: 10vmin;
text-align: center;
}

View file

@ -101,7 +101,7 @@ function UmamiLink({ href, name, target, children, ...props }) {
</a>
}
function App({ getString }) {
function App({ getString, locales, currentLocale, onLanguageChange }) {
const [frame, setFrame] = useState(null)
const [hashtag, setHashtag] = useState(null)
const [originalPhoto, setOriginalPhoto] = useState(null)
@ -382,6 +382,26 @@ function App({ getString }) {
<Localized id="link_app_contact" />
</UmamiLink>
</footer>
{
!!locales && !!onLanguageChange
? <div className="locale_chooser">
{
Object.entries(locales)
.map(([locale, name]) => {
return <button
className={locale === currentLocale ? 'isInRow choosen' : 'isInRow'}
key={locale}
data-locale={locale}
onClick={onLanguageChange}
>
{name}
</button>
})
}
</div>
: null
}
</div>
)
}
@ -414,25 +434,7 @@ function AppWrapper() {
userLocales={userLocales}
onLocaleChange={handleCurrentLocalesChange}
>
<>
<AppLocalized />
<div className="locale_chooser">
{
Object.entries(locales)
.map(([locale, name]) => {
return <button
className={locale === currentLocale ? 'isInRow choosen' : 'isInRow'}
key={locale}
data-locale={locale}
onClick={handleLanguageChange}
>
{name}
</button>
})
}
</div>
</>
<AppLocalized locales={locales} currentLocale={currentLocale} onLanguageChange={handleLanguageChange} />
</AppLocalizationProvider>
}
export default withLocalization(AppWrapper)