Skip to content

Commit

Permalink
feat: show items length next to sections name
Browse files Browse the repository at this point in the history
  • Loading branch information
devcatalin committed Sep 30, 2021
1 parent d28af6c commit d361b2a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function NavSectionHeader(props: {
isSectionVisible: boolean;
isCollapsedMode: 'collapsed' | 'expanded' | 'mixed';
level: number;
itemsLength: number;
expandSection: () => void;
collapseSection: () => void;
}) {
Expand All @@ -56,6 +57,7 @@ function NavSectionHeader(props: {
isSectionVisible,
isCollapsedMode,
level,
itemsLength,
expandSection,
collapseSection,
} = props;
Expand All @@ -80,6 +82,7 @@ function NavSectionHeader(props: {
level={level}
>
{name}
{itemsLength > 0 && <S.ItemsLength>{itemsLength}</S.ItemsLength>}
</S.Name>
{isHovered && isSectionInitialized && (
<S.Collapsible>
Expand Down Expand Up @@ -264,6 +267,7 @@ function NavSectionRenderer<ItemType, ScopeType>(props: NavSectionRendererProps<
isSectionVisible={isSectionVisible}
isCollapsedMode={isCollapsedMode}
level={level}
itemsLength={visibleItems.length}
expandSection={expandSection}
collapseSection={collapseSection}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Colors from '@styles/Colors';
import Colors, {FontColors} from '@styles/Colors';
import styled from 'styled-components';
import {Skeleton as RawSkeleton} from 'antd';
import {PlusSquareOutlined as RawPlusSquareOutlined} from '@ant-design/icons';
Expand Down Expand Up @@ -91,3 +91,9 @@ export const PlusSquareOutlined = styled(RawPlusSquareOutlined)<{isSelected: boo
}
}}
`;

export const ItemsLength = styled.span`
margin-left: 8px;
color: ${FontColors.grey};
font-size: 14px;
`;

0 comments on commit d361b2a

Please sign in to comment.