Skip to content

Commit

Permalink
Merge pull request #262 from mikecao/dev
Browse files Browse the repository at this point in the history
v0.72.0 Language menu
  • Loading branch information
mikecao authored Oct 2, 2020
2 parents a87356a + 0b13139 commit c906f01
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions components/common/Menu.module.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.menu {
background: var(--gray50);
border: 1px solid var(--gray500);
border-radius: 4px;
overflow: hidden;
Expand Down
3 changes: 2 additions & 1 deletion components/common/MenuButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default function MenuButton({
icon,
value,
options,
menuClassname,
menuPosition = 'bottom',
menuAlign = 'right',
onSelect,
Expand Down Expand Up @@ -45,7 +46,7 @@ export default function MenuButton({
</Button>
{showMenu && (
<Menu
className={styles.menu}
className={classNames(styles.menu, menuClassname)}
options={options}
selectedOption={selectedOption}
onSelect={handleSelect}
Expand Down
2 changes: 2 additions & 0 deletions components/settings/LanguageButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { menuOptions } from 'lib/lang';
import useLocale from 'hooks/useLocale';
import MenuButton from 'components/common/MenuButton';
import Globe from 'assets/globe.svg';
import styles from './LanguageButton.module.css';

export default function LanguageButton() {
const [locale, setLocale] = useLocale();
Expand Down Expand Up @@ -32,6 +33,7 @@ export default function LanguageButton() {
icon={<Globe />}
options={menuOptions}
value={locale}
menuClassname={styles.menu}
renderValue={option => option?.display}
onSelect={handleSelect}
/>
Expand Down
12 changes: 12 additions & 0 deletions components/settings/LanguageButton.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.menu {
display: flex;
flex-flow: row wrap;
min-width: 500px;
max-width: 100vw;
padding: 10px;
}

.menu div {
border-radius: 5px;
min-width: 33%;
}
2 changes: 1 addition & 1 deletion lib/lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ export const dateLocales = {
};

export const menuOptions = [
{ label: 'English', value: 'en-US', display: 'en' },
{ label: '中文', value: 'zh-CN', display: 'cn' },
{ label: 'Dansk', value: 'da-DK', display: 'da' },
{ label: 'Deutsch', value: 'de-DE', display: 'de' },
{ label: 'English', value: 'en-US', display: 'en' },
{ label: 'Español', value: 'es-MX', display: 'es' },
{ label: 'Føroyskt', value: 'fo-FO', display: 'fo' },
{ label: 'Français', value: 'fr-FR', display: 'fr' },
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "umami",
"version": "0.70.0",
"version": "0.72.0",
"description": "A simple, fast, website analytics alternative to Google Analytics. ",
"author": "Mike Cao <[email protected]>",
"license": "MIT",
Expand Down

1 comment on commit c906f01

@vercel
Copy link

@vercel vercel bot commented on c906f01 Oct 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.