diff --git a/app/soapbox/components/icon_with_counter.tsx b/app/soapbox/components/icon_with_counter.tsx index 994409942..45c346064 100644 --- a/app/soapbox/components/icon_with_counter.tsx +++ b/app/soapbox/components/icon_with_counter.tsx @@ -16,7 +16,7 @@ const IconWithCounter: React.FC = ({ icon, count, countMax, .. {count > 0 && ( - + )} diff --git a/app/soapbox/components/sidebar-navigation-link.tsx b/app/soapbox/components/sidebar-navigation-link.tsx index 44d76707d..d464d6c2f 100644 --- a/app/soapbox/components/sidebar-navigation-link.tsx +++ b/app/soapbox/components/sidebar-navigation-link.tsx @@ -2,7 +2,7 @@ import classNames from 'clsx'; import React from 'react'; import { NavLink } from 'react-router-dom'; -import { Counter, HStack, Icon, Text } from './ui'; +import { Icon, Text } from './ui'; interface ISidebarNavigationLink { /** Notification count, if any. */ @@ -46,19 +46,15 @@ const SidebarNavigationLink = React.forwardRef((props: ISidebarNavigationLink, r - - {text} - - {count ? ( - - ) : null} - + {text} ); }); diff --git a/app/soapbox/components/sidebar-navigation.tsx b/app/soapbox/components/sidebar-navigation.tsx index 593df7513..7f8609fa5 100644 --- a/app/soapbox/components/sidebar-navigation.tsx +++ b/app/soapbox/components/sidebar-navigation.tsx @@ -116,7 +116,7 @@ const SidebarNavigation = () => { to='/chats' icon={require('@tabler/icons/mail.svg')} count={unreadChatsCount} - countMax={20} + countMax={9} text={} /> ); diff --git a/app/soapbox/components/thumb_navigation.tsx b/app/soapbox/components/thumb_navigation.tsx index c66dced08..b0040843d 100644 --- a/app/soapbox/components/thumb_navigation.tsx +++ b/app/soapbox/components/thumb_navigation.tsx @@ -24,7 +24,7 @@ const ThumbNavigation: React.FC = (): JSX.Element => { to='/chats' exact count={unreadChatsCount} - countMax={20} + countMax={9} /> ); } diff --git a/app/soapbox/components/ui/counter/counter.tsx b/app/soapbox/components/ui/counter/counter.tsx index 3ddbf00a6..983263b95 100644 --- a/app/soapbox/components/ui/counter/counter.tsx +++ b/app/soapbox/components/ui/counter/counter.tsx @@ -12,7 +12,7 @@ interface ICounter { /** A simple counter for notifications, etc. */ const Counter: React.FC = ({ count, countMax }) => { return ( - + {shortNumberFormat(count, countMax)} ); diff --git a/app/soapbox/components/ui/icon/icon.tsx b/app/soapbox/components/ui/icon/icon.tsx index 50ea5afbe..55e83b0df 100644 --- a/app/soapbox/components/ui/icon/icon.tsx +++ b/app/soapbox/components/ui/icon/icon.tsx @@ -9,6 +9,8 @@ interface IIcon extends Pick, 'strokeWidth'> { className?: string, /** Number to display a counter over the icon. */ count?: number, + /** Optional max to cap count (ie: N+) */ + countMax?: number, /** Tooltip text for the icon. */ alt?: string, /** URL to the svg icon. */ @@ -18,11 +20,11 @@ interface IIcon extends Pick, 'strokeWidth'> { } /** Renders and SVG icon with optional counter. */ -const Icon: React.FC = ({ src, alt, count, size, ...filteredProps }): JSX.Element => ( -
+const Icon: React.FC = ({ src, alt, count, size, countMax, ...filteredProps }): JSX.Element => ( +
{count ? ( - - + + ) : null}