Skip to content

Commit

Permalink
fix: sidebar full height
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed May 30, 2020
1 parent 97bd559 commit cb2cdbe
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const Layout: FC<LayoutProps> = ({
/>
<SEO title={title} />
<SidebarContextProvider>
<Flex sx={{ flexDirection: 'row' }}>
<Flex sx={{ flexDirection: 'row', alignItems: 'stretch' }}>
<Sidebar storyId={storyId} />
<Container>
<Tabs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const Sidebar: FC<SidebarProps> = ({ storyId }) => {

const [search, setSearch] = useState<string | undefined>(undefined);
return (
<AppSidebar sx={{ px: 1 }} width={380}>
<AppSidebar sx={{ px: 1, backgroundColor: 'gray' }} width={380}>
{siteTitle}
<Input
placeholder="search stories..."
Expand Down
4 changes: 2 additions & 2 deletions ui/app-components/src/Navmenu/Navmenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ export const Navmenu: FC<NavMenuProps> = props => {
};
const { filteredItems } = state;
return (
<React.Fragment>
<Box as="nav">
{filteredItems && filteredItems.map(item => renderItem(item, 1))}
</React.Fragment>
</Box>
);
};
43 changes: 22 additions & 21 deletions ui/app-components/src/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @jsx jsx */
import React, { FC, Fragment, useContext } from 'react';
import React, { FC, useContext } from 'react';
import { jsx, Box, Flex, BoxProps, Heading } from 'theme-ui';
import { useBreakpointIndex } from '@theme-ui/match-media';
import { Collapsible, CollapsibleProps } from '@component-controls/components';
Expand Down Expand Up @@ -47,26 +47,27 @@ export const Sidebar: FC<SidebarProps & BoxProps> = ({
const isCollapsed =
(collapsible && size <= 1 && collapsed === undefined) || collapsed === true;
return (
<Fragment>
<Collapsible isOpen={!isCollapsed} easing="ease-in-out" {...animate}>
<Box sx={{ width }} {...rest}>
<Flex sx={{ pb: 1, flexDirection: 'row', alignItems: 'center' }}>
{title && (
<Box as="header">
{typeof title === 'string' ? (
<Heading as="h3" sx={{ pl: 2 }}>
{title}
</Heading>
) : (
title
)}
</Box>
)}
</Flex>
<Collapsible isOpen={!isCollapsed} easing="ease-in-out" {...animate}>
<Box
sx={{ overflowY: 'auto', height: '100%', overflowX: 'hidden', width }}
{...rest}
>
<Flex sx={{ pb: 1, flexDirection: 'row', alignItems: 'center' }}>
{title && (
<Box as="header">
{typeof title === 'string' ? (
<Heading as="h3" sx={{ pl: 2 }}>
{title}
</Heading>
) : (
title
)}
</Box>
)}
</Flex>

{children}
</Box>
</Collapsible>
</Fragment>
{children}
</Box>
</Collapsible>
);
};
2 changes: 1 addition & 1 deletion ui/components/src/Collapsible/Collapsible.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const Collapsible: FC<CollapsibleProps> = ({
...rest
}) => {
return (
<AnimateHeight {...rest} height={isOpen ? 'auto' : 0}>
<AnimateHeight height={isOpen ? 'auto' : 0} {...rest}>
{isOpen ? children : ''}
</AnimateHeight>
);
Expand Down

0 comments on commit cb2cdbe

Please sign in to comment.