ag-common 0.0.173 → 0.0.174
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const Sidebar: ({ children, className, key, cookieDocument, }: {
|
|
2
|
+
export declare const Sidebar: ({ children, className, key, cookieDocument, width, }: {
|
|
3
3
|
children: any;
|
|
4
4
|
className?: string | undefined;
|
|
5
5
|
/**
|
|
@@ -10,4 +10,8 @@ export declare const Sidebar: ({ children, className, key, cookieDocument, }: {
|
|
|
10
10
|
* optionally pass in SSR cookiedocument
|
|
11
11
|
*/
|
|
12
12
|
cookieDocument?: string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* default 15rem
|
|
15
|
+
*/
|
|
16
|
+
width?: string | undefined;
|
|
13
17
|
}) => JSX.Element;
|
|
@@ -12,10 +12,10 @@ const react_1 = __importDefault(require("react"));
|
|
|
12
12
|
const Base = styled_components_1.default.div `
|
|
13
13
|
position: relative;
|
|
14
14
|
transition: all 200ms;
|
|
15
|
-
width: 15rem;
|
|
16
15
|
border-right: solid 1px #ccc;
|
|
17
16
|
margin-right: 1rem;
|
|
18
17
|
padding-left: 0.5rem;
|
|
18
|
+
//width set in style
|
|
19
19
|
|
|
20
20
|
&[data-open='false'] {
|
|
21
21
|
width: 0.5rem;
|
|
@@ -44,7 +44,7 @@ const ContentBlock = styled_components_1.default.div `
|
|
|
44
44
|
position: absolute;
|
|
45
45
|
top: 0;
|
|
46
46
|
z-index: 1;
|
|
47
|
-
width
|
|
47
|
+
//width set in style
|
|
48
48
|
}
|
|
49
49
|
`;
|
|
50
50
|
const Content = styled_components_1.default.div `
|
|
@@ -91,16 +91,20 @@ const ChevronStyled = (0, styled_components_1.default)(Chevron_1.Chevron) `
|
|
|
91
91
|
fill: #555;
|
|
92
92
|
}
|
|
93
93
|
`;
|
|
94
|
-
const Sidebar = ({ children, className, key = 'sidebar', cookieDocument, }) => {
|
|
94
|
+
const Sidebar = ({ children, className, key = 'sidebar', cookieDocument, width = '15rem', }) => {
|
|
95
95
|
const [open, setOpen] = (0, use_1.useCookieBoolean)({
|
|
96
96
|
name: key,
|
|
97
97
|
defaultValue: false,
|
|
98
98
|
cookieDocument: cookieDocument,
|
|
99
99
|
});
|
|
100
|
-
|
|
100
|
+
let contentBlockWidth = undefined;
|
|
101
|
+
if (open) {
|
|
102
|
+
contentBlockWidth = width;
|
|
103
|
+
}
|
|
104
|
+
return (react_1.default.createElement(Base, { className: className, "data-open": open, onClick: () => !open && setOpen(true), "data-hover": true, style: { width } },
|
|
101
105
|
react_1.default.createElement(Hamburger, { "data-open": open, onClick: () => setOpen(!open), "data-hover": true },
|
|
102
106
|
react_1.default.createElement(ChevronStyled, { point: open ? 'left' : 'right', width: "100%" })),
|
|
103
|
-
react_1.default.createElement(ContentBlock, { "data-content": true, "data-open": open },
|
|
107
|
+
react_1.default.createElement(ContentBlock, { "data-content": true, "data-open": open, style: { width: contentBlockWidth } },
|
|
104
108
|
react_1.default.createElement(Content, { "data-open": open, onClick: (e) => {
|
|
105
109
|
e.stopPropagation();
|
|
106
110
|
} }, children))));
|