1
0
Fork 0
mirror of https://github.com/voltbonn/profile-picture-generator.git synced 2024-12-22 15:55:08 +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{ .locale_chooser{
margin: -8vmin 10vmin 10vmin 10vmin; margin: 10vmin;
text-align: center; text-align: center;
} }

View file

@ -101,7 +101,7 @@ function UmamiLink({ href, name, target, children, ...props }) {
</a> </a>
} }
function App({ getString }) { function App({ getString, locales, currentLocale, onLanguageChange }) {
const [frame, setFrame] = useState(null) const [frame, setFrame] = useState(null)
const [hashtag, setHashtag] = useState(null) const [hashtag, setHashtag] = useState(null)
const [originalPhoto, setOriginalPhoto] = useState(null) const [originalPhoto, setOriginalPhoto] = useState(null)
@ -382,6 +382,26 @@ function App({ getString }) {
<Localized id="link_app_contact" /> <Localized id="link_app_contact" />
</UmamiLink> </UmamiLink>
</footer> </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> </div>
) )
} }
@ -414,25 +434,7 @@ function AppWrapper() {
userLocales={userLocales} userLocales={userLocales}
onLocaleChange={handleCurrentLocalesChange} onLocaleChange={handleCurrentLocalesChange}
> >
<> <AppLocalized locales={locales} currentLocale={currentLocale} onLanguageChange={handleLanguageChange} />
<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>
</>
</AppLocalizationProvider> </AppLocalizationProvider>
} }
export default withLocalization(AppWrapper) export default withLocalization(AppWrapper)