ghost-portal/packages/react-components/src/Sidebar.tsx
Jaco Greeff 59623f419b
(Very) experimental dark theme (only localhost) (#3731)
* (Very) experimental dark theme (only localhost)

* Listener for theme changes

* ThemeProps

* Use actual theme with colors

* Page background

* Adjust with theme.bgPage

* Table adjustments

* Some progress (menu & inputs)

* Adjustments in a number of places

* Progress colors

* Modals

* Some calandar stuff

* Toggle

* Updates

* Hack around dropdowns

* Popup menus

* Overlays

* Connecting overlays
2020-10-01 15:50:33 +02:00

58 lines
1.3 KiB
TypeScript

// Copyright 2017-2020 @polkadot/app-accounts authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { ThemeProps } from './types';
import React from 'react';
import styled from 'styled-components';
import Button from './Button';
interface Props {
button?: React.ReactNode;
children: React.ReactNode;
className?: string;
offset?: number | string;
onClose: () => void;
position: 'left' | 'right';
}
function Sidebar ({ button, children, className = '', onClose }: Props): React.ReactElement<Props> {
return (
<div className={`ui--Sidebar ${className}`}>
<Button.Group className='ui--Sidebar-buttons'>
{button}
<Button
icon='times'
isBasic
isCircular
onClick={onClose}
/>
</Button.Group>
{children}
</div>
);
}
export default React.memo(styled(Sidebar)(({ offset = 0, position, theme }: Props & ThemeProps) => `
background: ${theme.bgPage};
bottom: 0;
box-shadow: ${position === 'right' ? '-6px' : '6px'} 0px 20px 0px rgba(0, 0, 0, 0.3);
margin-left: -0.125rem;
max-width: 24rem;
min-width: 24rem;
position: fixed;
padding: 1rem;
overflow-y: auto;
top: 0;
z-index: 999;
${position}: ${offset};
.ui--Sidebar-buttons {
margin: 0;
position: absolute;
right: 0.5rem;
top: 0.5rem;
}
`));