Skip to content

Commit f2f98f6

Browse files
committed
export sidebarnav styles as object to help importing
1 parent 2362bd6 commit f2f98f6

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

src/components/SidebarNav.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useMatchMediaQuery } from "../../src/hooks";
22
import styled, { createGlobalStyle } from "styled-components";
3-
import { SidebarNav, sidebarNavCollapsedWidth } from "./SidebarNav";
3+
import { SidebarNav, SidebarNavStyles } from "./SidebarNav";
44

55
const GlobalStyle = createGlobalStyle`
66
html, body, #ladle-root {
@@ -72,7 +72,7 @@ export const Default = () => {
7272
</>
7373
)}
7474
</StyledSidebarNav>
75-
<StyledMain style={{ padding: "4rem", marginLeft: (isMobile ? sidebarNavCollapsedWidth : '') }}>
75+
<StyledMain style={{ padding: "4rem", marginLeft: (isMobile ? SidebarNavStyles.collapsedWidth : '') }}>
7676
<h1>Main content</h1>
7777
</StyledMain>
7878
</Wrapper>

src/components/SidebarNav.tsx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { breakpoints, colors } from "../theme";
77
import { Dialog, Modal } from "react-aria-components";
88
import { useMatchMediaQuery } from "../hooks";
99

10-
export const sidebarNavCollapsedWidth = "5.6rem";
11-
export const sidebarNavExpandedWidth = "24rem";
10+
const collapsedWidth = "5.6rem";
11+
const expandedWidth = "24rem";
1212

1313
const GlobalStyle = createGlobalStyle`
1414
.react-aria-ModalOverlay {
@@ -20,17 +20,17 @@ const GlobalStyle = createGlobalStyle`
2020
background: rgba(0 0 0 / .7);
2121
z-index: 100;
2222
}
23-
xb`;
23+
`;
2424

2525
const StyledModal = styled(Modal)`
2626
position: fixed;
2727
outline: none;
2828
left: 0;
2929
`;
3030

31-
export const Nav = styled.nav`
32-
--collapsed-width: ${sidebarNavCollapsedWidth};
33-
--expanded-width: ${sidebarNavExpandedWidth};
31+
const Nav = styled.nav`
32+
--collapsed-width: ${collapsedWidth};
33+
--expanded-width: ${expandedWidth};
3434
width: var(--expanded-width);
3535
display: flex;
3636
justify-content: space-between;
@@ -99,7 +99,7 @@ const NavFooter = styled.footer`
9999
}
100100
`;
101101

102-
export const ToggleButton = styled.button`
102+
const ToggleButton = styled.button`
103103
position: absolute;
104104
right: 0;
105105
top: 1.8rem;
@@ -227,3 +227,12 @@ export const SidebarNav = styled(
227227
);
228228
},
229229
)``;
230+
231+
export const SidebarNavStyles = {
232+
Nav,
233+
NavHeader,
234+
NavBody,
235+
NavFooter,
236+
expandedWidth,
237+
collapsedWidth
238+
};

0 commit comments

Comments
 (0)