Skip to content

Commit a8dba47

Browse files
committed
Removing group title styles & React.Children.count
1 parent 39c8993 commit a8dba47

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

lib/src/sidenav/Sidenav.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,7 @@ const DxcSidenav = ({ title, children }: SidenavPropsType): JSX.Element => {
2323
<BackgroundColorProvider color={colorsTheme.sidenav.backgroundColor}>
2424
{title}
2525
<DxcFlex direction="column" gap="1rem">
26-
{React.Children.map(children, (child, index) => {
27-
return (
28-
<>
29-
{child}
30-
{index !== React.Children.count(children) - 1 && <Divider />}
31-
</>
32-
);
33-
})}
26+
{children}
3427
</DxcFlex>
3528
</BackgroundColorProvider>
3629
</SidenavContainer>
@@ -45,9 +38,12 @@ const Title = ({ children }: SidenavTitlePropsType): JSX.Element => (
4538
);
4639

4740
const Section = ({ children }: SidenavSectionPropsType): JSX.Element => (
48-
<DxcBleed horizontal="1rem">
49-
<DxcFlex direction="column">{children}</DxcFlex>
50-
</DxcBleed>
41+
<>
42+
<DxcBleed horizontal="1rem">
43+
<DxcFlex direction="column">{children}</DxcFlex>
44+
</DxcBleed>
45+
<Divider />
46+
</>
5147
);
5248

5349
const GroupContext = React.createContext<React.Dispatch<React.SetStateAction<boolean>> | null>(null);
@@ -164,6 +160,10 @@ const Divider = styled.div`
164160
width: 100%;
165161
height: 1px;
166162
background-color: #999999;
163+
164+
&:last-child {
165+
display: none;
166+
}
167167
`;
168168

169169
const SidenavGroup = styled.div`
@@ -221,8 +221,8 @@ const SidenavGroupTitleButton = styled.button<{ selectedGroup: boolean }>`
221221
: `color: ${props.theme.groupTitleFontColor}; background-color: ${props.theme.groupTitleHoverBackgroundColor};`}
222222
}
223223
&:active {
224-
background-color: ${(props) => (props.selectedGroup ? "#4d4d4d" : props.theme.groupTitleActiveBackgroundColor)};
225-
color: ${(props) => (props.selectedGroup ? "#ffffff" : props.theme.groupTitleFontColor)};
224+
background-color: ${(props) => props.theme.groupTitleActiveBackgroundColor};
225+
color: ${(props) => props.theme.groupTitleFontColor};
226226
}
227227
228228
img,

0 commit comments

Comments
 (0)