From fbfb1d6d1a43e731f348b1efa47b8122855d6592 Mon Sep 17 00:00:00 2001 From: atanasster Date: Sun, 14 Jun 2020 16:13:38 -0400 Subject: [PATCH] fix: sidebar css issues --- ui/app-components/src/Sidebar/Sidebar.tsx | 64 +++++++---------------- ui/app-components/src/typings.d.ts | 1 + ui/app/src/App/App.tsx | 2 +- ui/app/src/SideContext/SideContext.tsx | 2 +- ui/app/src/Sidebar/Sidebar.tsx | 2 +- ui/app/src/SidebarsPage/SidebarsPage.tsx | 6 +-- ui/components/src/Tag/Tag.tsx | 5 +- ui/components/src/ThemeContext/theme.ts | 49 ++++++++--------- 8 files changed, 52 insertions(+), 79 deletions(-) diff --git a/ui/app-components/src/Sidebar/Sidebar.tsx b/ui/app-components/src/Sidebar/Sidebar.tsx index eb9017808..f4c0b1407 100644 --- a/ui/app-components/src/Sidebar/Sidebar.tsx +++ b/ui/app-components/src/Sidebar/Sidebar.tsx @@ -1,6 +1,9 @@ /** @jsx jsx */ import React, { FC, useContext } from 'react'; import { jsx, Box, BoxProps, Heading } from 'theme-ui'; +import { get } from '@theme-ui/css'; +import { useTheme } from '@component-controls/components'; + import { SidebarContext } from './SidebarContext'; export interface SidebarProps { @@ -9,16 +12,6 @@ export interface SidebarProps { */ title?: React.ReactNode; - /** - * The width of the side bar in pixels - */ - width?: number; - - /** - * min width for sidebar - */ - minWidth?: number; - /** * Whether the sidebar can be collapsed */ @@ -35,51 +28,34 @@ export interface SidebarProps { */ export const Sidebar: FC = ({ title, - width = '100%', - minWidth, children, + variant, ...rest }) => { const toggleContext = useContext(SidebarContext); const { collapsed, responsive, setCollapsed } = toggleContext || {}; - + const theme = useTheme(); return collapsed ? null : ( responsive && setCollapsed(true)} {...rest} > - responsive && setCollapsed(true)} - > - - {title && ( - - {typeof title === 'string' ? ( - - {title} - - ) : ( - title - )} - - )} - - {children} + + {title && ( + + {typeof title === 'string' ? ( + + {title} + + ) : ( + title + )} + + )} + {children} ); }; diff --git a/ui/app-components/src/typings.d.ts b/ui/app-components/src/typings.d.ts index d4ceab75b..376b02da5 100644 --- a/ui/app-components/src/typings.d.ts +++ b/ui/app-components/src/typings.d.ts @@ -1 +1,2 @@ declare module '@theme-ui/match-media'; +declare module '@theme-ui/css'; diff --git a/ui/app/src/App/App.tsx b/ui/app/src/App/App.tsx index 2b5a72b0c..64aa41431 100644 --- a/ui/app/src/App/App.tsx +++ b/ui/app/src/App/App.tsx @@ -45,7 +45,7 @@ export const App: FC = ({ title, children }) => { -
+
{children}