ghost-portal/packages/apps/src/Apps.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

55 lines
1.6 KiB
TypeScript

// Copyright 2017-2020 @polkadot/apps authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BareProps as Props, ThemeDef, ThemeProps } from '@polkadot/react-components/types';
import React, { useContext, useMemo } from 'react';
import styled, { ThemeContext } from 'styled-components';
import AccountSidebar from '@polkadot/app-accounts/Sidebar';
import { getSystemChainColor } from '@polkadot/apps-config/ui';
import GlobalStyle from '@polkadot/react-components/styles';
import { useApi } from '@polkadot/react-hooks';
import Signer from '@polkadot/react-signer';
import ConnectingOverlay from './overlays/Connecting';
import Content from './Content';
import Menu from './Menu';
import WarmUp from './WarmUp';
export const PORTAL_ID = 'portals';
function Apps ({ className = '' }: Props): React.ReactElement<Props> {
const { theme } = useContext<ThemeDef>(ThemeContext);
const { systemChain, systemName } = useApi();
const uiHighlight = useMemo(
() => getSystemChainColor(systemChain, systemName),
[systemChain, systemName]
);
return (
<>
<GlobalStyle uiHighlight={uiHighlight} />
<div className={`apps--Wrapper theme--${theme} ${className}`}>
<Menu />
<AccountSidebar>
<Signer>
<Content />
</Signer>
<ConnectingOverlay />
<div id={PORTAL_ID} />
</AccountSidebar>
</div>
<WarmUp />
</>
);
}
export default React.memo(styled(Apps)(({ theme }: ThemeProps) => `
background: ${theme.bgPage};
box-sizing: border-box;
display: flex;
flex-direction: column;
min-height: 100vh;
`));