diff --git a/apps/cowswap-frontend/src/modules/trade/containers/TradeWidgetLinks/index.tsx b/apps/cowswap-frontend/src/modules/trade/containers/TradeWidgetLinks/index.tsx index 08ac319e6d..65bf8dda31 100644 --- a/apps/cowswap-frontend/src/modules/trade/containers/TradeWidgetLinks/index.tsx +++ b/apps/cowswap-frontend/src/modules/trade/containers/TradeWidgetLinks/index.tsx @@ -1,4 +1,4 @@ -import { useMemo, useState } from 'react' +import { useMemo, useState, useCallback } from 'react' import { Command } from '@cowprotocol/types' import { Badge } from '@cowprotocol/ui' @@ -43,10 +43,9 @@ export function TradeWidgetLinks({ isDropdown = false }: TradeWidgetLinksProps) const { enabledTradeTypes } = useInjectedWidgetParams() const menuItems = useMenuItems() - const handleMenuItemClick = (_item?: MenuItemConfig) => { - if (menuItemsElements.length === 1) return + const handleMenuItemClick = useCallback((_item?: MenuItemConfig): void => { setDropdownVisible(false) - } + }, []) const enabledItems = useMemo(() => { return menuItems.filter((item) => { @@ -56,7 +55,7 @@ export function TradeWidgetLinks({ isDropdown = false }: TradeWidgetLinksProps) }) }, [menuItems, enabledTradeTypes]) - const menuItemsElements = useMemo(() => { + const menuItemsElements: JSX.Element[] = useMemo(() => { return enabledItems.map((item) => { const routePath = parameterizeTradeRoute(tradeContext, item.route, true) const isActive = !!matchPath(location.pathname, routePath.split('?')[0]) @@ -119,7 +118,7 @@ const MenuItem = ({ {item.label} {!isActive && item.badge && ( - + {item.badge} )} diff --git a/libs/ui/src/pure/Badge/index.tsx b/libs/ui/src/pure/Badge/index.tsx index 3ce2c3a7cf..5346854894 100644 --- a/libs/ui/src/pure/Badge/index.tsx +++ b/libs/ui/src/pure/Badge/index.tsx @@ -5,7 +5,7 @@ import { BadgeType } from '../../types' const badgeBackgrounds: Record = { information: `var(${UI.COLOR_INFO_BG})`, - alert: `var(${UI.COLOR_BADGE_YELLOW_BG})`, + alert: `var(${UI.COLOR_ALERT_BG})`, alert2: `var(${UI.COLOR_BADGE_YELLOW_BG})`, success: `var(${UI.COLOR_SUCCESS_BG})`, default: 'transparent', // text only @@ -13,7 +13,7 @@ const badgeBackgrounds: Record = { const badgeColors: Record = { information: `var(${UI.COLOR_INFO_TEXT})`, - alert: `var(${UI.COLOR_BADGE_YELLOW_TEXT})`, + alert: `var(${UI.COLOR_ALERT_TEXT})`, alert2: `var(${UI.COLOR_BADGE_YELLOW_TEXT})`, success: `var(${UI.COLOR_SUCCESS_TEXT})`, default: `var(${UI.COLOR_DISABLED_TEXT})`, // text only @@ -25,7 +25,7 @@ export const Badge = styled.div<{ type?: BadgeType }>` border: 0; cursor: pointer; border-radius: 16px; - font-size: 9px; + font-size: 10px; font-weight: inherit; text-transform: uppercase; padding: ${({ type }) => (!type || type === 'default' ? '0' : '4px 6px')}; diff --git a/libs/ui/src/pure/MenuBar/index.tsx b/libs/ui/src/pure/MenuBar/index.tsx index 346d412053..852b07499f 100644 --- a/libs/ui/src/pure/MenuBar/index.tsx +++ b/libs/ui/src/pure/MenuBar/index.tsx @@ -412,7 +412,7 @@ const GenericDropdown: React.FC = ({ {item.label} - {item.badge && {item.badge}} + {item.badge && {item.badge}} {item.children && } {isOpen && ( @@ -483,7 +483,7 @@ const DropdownContentWrapper: React.FC = ({ {item.label} - {item.badge && {item.badge}} + {item.badge && {item.badge}} {item.description && {item.description}}