Skip to content

Commit 745cd1b

Browse files
committed
Del closing arrow
1 parent d810407 commit 745cd1b

File tree

1 file changed

+39
-42
lines changed

1 file changed

+39
-42
lines changed

src/components/Sidebar.tsx

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,56 @@
11
import { mediaQuery } from "../hooks/media-query";
2-
import { FC } from "react"
2+
import { FC } from "react";
33
import { Divider, IconButton, Typography } from "@material-ui/core";
44
import styled from "styled-components";
55

66
import AppIcon from "./AppIcon";
77

88
const Header = styled.div`
9-
display: flex;
10-
align-items: center;
11-
justify-content: space-between;
12-
padding-left: 16px;
9+
display: flex;
10+
align-items: center;
11+
justify-content: space-between;
12+
padding-left: 16px;
1313
`;
1414

1515
const SidebarWrapper = styled.aside<{ closed: boolean }>`
16-
display: flex;
17-
flex-direction: column;
18-
z-index: 2;
19-
background: white;
20-
height: 100%;
21-
overflow-x: hidden;
22-
transition: width 125ms ease-in;
23-
width: ${p => p.closed ? '0px' : '320px'};
24-
box-shadow: ${p => p.closed ? '' : '1px 0px 4px 1px #bbb'};
25-
26-
/* Override so the sidebar takes all screen on mobile */
27-
${p => p.closed
28-
? mediaQuery('sm')`width: 0px`
29-
: mediaQuery('sm')`width: 100vw`
30-
}
16+
display: flex;
17+
flex-direction: column;
18+
z-index: 2;
19+
background: white;
20+
height: 100%;
21+
overflow-x: hidden;
22+
transition: width 125ms ease-in;
23+
width: ${(p) => (p.closed ? "0px" : "320px")};
24+
box-shadow: ${(p) => (p.closed ? "" : "1px 0px 4px 1px #bbb")};
25+
26+
/* Override so the sidebar takes all screen on mobile */
27+
${(p) =>
28+
p.closed ? mediaQuery("sm")`width: 0px` : mediaQuery("sm")`width: 100vw`}
3129
`;
3230

3331
export interface SidebarProps {
34-
open: boolean;
35-
title: string;
36-
onClose: () => void;
32+
open: boolean;
33+
title: string;
34+
onClose: () => void;
3735
}
3836

39-
export const Sidebar: FC<SidebarProps> = ({ children, title, onClose, open = false, ...props }) => {
40-
return <SidebarWrapper closed={!open} {...props}>
41-
<Header>
42-
<Typography variant="overline">
43-
{title}
44-
</Typography>
45-
<IconButton
46-
style={{ width: '40px', height: '40px' }}
47-
size="small"
48-
onClick={onClose}
49-
>
50-
<AppIcon name='chevron-left' />
51-
</IconButton>
52-
</Header>
53-
54-
<Divider />
55-
{children}
37+
export const Sidebar: FC<SidebarProps> = ({
38+
children,
39+
title,
40+
onClose,
41+
open = false,
42+
...props
43+
}) => {
44+
return (
45+
<SidebarWrapper closed={!open} {...props}>
46+
<Header>
47+
<Typography variant="overline">{title}</Typography>
48+
</Header>
49+
50+
<Divider />
51+
{children}
5652
</SidebarWrapper>
57-
}
53+
);
54+
};
5855

59-
export default Sidebar;
56+
export default Sidebar;

0 commit comments

Comments
 (0)