From a1ddedca75c77e9d791db0458dbe1a098813d476 Mon Sep 17 00:00:00 2001 From: utkarsha-deriv Date: Wed, 21 Jun 2023 13:04:39 +0400 Subject: [PATCH] refactor: use classnames --- docusaurus.config.js | 6 +++--- src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 64ccad75f..f74b7b472 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -24,13 +24,13 @@ const config = { // to replace "en" with "zh-Hans". i18n: { defaultLocale: 'en', - locales: ['en', 'pr'], + locales: ['en', 'es'], localeConfigs: { en: { label: 'English', }, - pr: { - label: 'Portuguese', + es: { + label: 'EspaƱol', }, }, }, diff --git a/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx b/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx index 01835750e..9a84d1a7d 100644 --- a/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +++ b/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx @@ -5,9 +5,9 @@ import { useLocation } from '@docusaurus/router'; import DropdownNavbarItem from '@theme/NavbarItem/DropdownNavbarItem'; import type { LinkLikeNavbarItemProps } from '@theme/NavbarItem'; import type { Props } from '@theme/NavbarItem/LocaleDropdownNavbarItem'; +import classnames from 'classnames'; export default function LocaleDropdownNavbarItem({ - // mobile, dropdownItemsBefore, dropdownItemsAfter, ...props @@ -31,9 +31,7 @@ export default function LocaleDropdownNavbarItem({ to, target: '_self', autoAddBaseUrl: false, - className: - // eslint-disable-next-line no-nested-ternary - locale === currentLocale ? 'dropdown__link--active' : '', + className: classnames({ 'dropdown__link--active': locale === currentLocale }), }; }); @@ -44,8 +42,7 @@ export default function LocaleDropdownNavbarItem({ return ( {dropdownLabel === 'English' ? 'EN' : 'PT'}} + label={<>{dropdownLabel === 'English' ? 'EN' : 'ES'}} items={items} /> );