Skip to content

Commit 11ab3c1

Browse files
committed
Reverting last Sidenav implementation
1 parent a8dba47 commit 11ab3c1

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

lib/src/layout/types.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
type ChildrenType = AppLayoutMainPropsType | AppLayoutSidenavPropsType;
2-
31
export type AppLayoutMainPropsType = {
42
/**
53
* Everything between the tags will be displayed as the content of the main part of the application.
@@ -37,9 +35,9 @@ type AppLayoutPropsType = {
3735
*/
3836
footer?: React.ReactNode;
3937
/**
40-
* The area inside the sidenav. This area can be used to render custom content.
38+
* Use the DxcApplicationLayout.Main provided to render main content.
4139
*/
42-
children: React.ReactElement<ChildrenType> | React.ReactElement<ChildrenType>[];
40+
children: React.ReactElement<AppLayoutMainPropsType>;
4341
};
4442

4543
export default AppLayoutPropsType;

lib/src/sidenav/Sidenav.tsx

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

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

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

169169
const SidenavGroup = styled.div`

0 commit comments

Comments
 (0)