Skip to content

Commit

Permalink
Add selected color to menus
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaw3d committed Jul 31, 2024
1 parent b637f16 commit 06835b8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 27 deletions.
1 change: 1 addition & 0 deletions .changelog/2024.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change menu colors
10 changes: 6 additions & 4 deletions src/app/components/LanguageSelect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Text } from 'grommet/es6/components/Text'
import { Language } from 'styles/theme/icons/language/Language'
import { SelectWithIcon } from '../SelectWithIcon'
import { languageLabels, LanguageKey } from '../../../locales/i18n'
import { ButtonExtendedProps } from 'grommet/es6/components/Button'

const languageOptions: { value: LanguageKey; label: string }[] = languageLabels.map(lang => ({
value: lang[0],
Expand Down Expand Up @@ -38,10 +39,11 @@ export const LanguageMenu = () => {
return null
}

const languageOptions = languageLabels.map(lang => ({
value: lang[0],
label: lang[1],
onClick: () => i18n.changeLanguage(lang[0]),
const languageOptions: ButtonExtendedProps[] = languageLabels.map(([key, label]) => ({
value: key,
label: label,
onClick: () => i18n.changeLanguage(key),
primary: key === i18n.resolvedLanguage,
}))
const selectedLabel = languageOptions.find(lang => lang.value === i18n.resolvedLanguage)?.label

Expand Down
1 change: 1 addition & 0 deletions src/app/components/Sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ const SidebarFooter = (props: SidebarFooterProps) => {
items={languageLabels.map(([key, label]) => ({
label: label,
onClick: () => setLanguage(key),
primary: key === i18n.resolvedLanguage,
}))}
a11yTitle="Language"
>
Expand Down
32 changes: 9 additions & 23 deletions src/app/components/Toolbar/Features/NetworkSelector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,12 @@ export const NetworkSelector = memo((props: Props) => {
}

const network = networkLabels[selectedNetworkType]
const menuItems = [
{
label: networkLabels['mainnet'],
onClick: () => {
switchNetwork('mainnet')
},
},
{
label: networkLabels['testnet'],
onClick: () => {
switchNetwork('testnet')
},
},
const networks = [
'mainnet' as const,
'testnet' as const,
...(process.env.REACT_APP_LOCALNET ? ['local' as const] : []),
]

if (process.env.REACT_APP_LOCALNET) {
menuItems.push({
label: networkLabels['local'],
onClick: () => {
switchNetwork('local')
},
})
}

return (
<Menu
size="small"
Expand All @@ -66,7 +48,11 @@ export const NetworkSelector = memo((props: Props) => {
align: { top: 'bottom', left: 'left' },
elevation: 'xlarge',
}}
items={menuItems}
items={networks.map(value => ({
label: networkLabels[value],
onClick: () => switchNetwork(value),
primary: value === selectedNetworkType,
}))}
fill
a11yTitle={t('toolbar.networks.selector', 'Select network')}
>
Expand Down

0 comments on commit 06835b8

Please sign in to comment.