aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/components/ui/overlay.tsx
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-11-08 12:53:25 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-11-08 12:53:25 +0800
commit4181a040b5d5ca2335556948585278133ec63bd1 (patch)
tree8174e8817d9658f0d53b1ddd61fe0552de4630ed /packages/instant/src/components/ui/overlay.tsx
parentc0d8ceca82a91a3a6c222e71ecb58f2cd95da62e (diff)
downloaddexon-sol-tools-4181a040b5d5ca2335556948585278133ec63bd1.tar
dexon-sol-tools-4181a040b5d5ca2335556948585278133ec63bd1.tar.gz
dexon-sol-tools-4181a040b5d5ca2335556948585278133ec63bd1.tar.bz2
dexon-sol-tools-4181a040b5d5ca2335556948585278133ec63bd1.tar.lz
dexon-sol-tools-4181a040b5d5ca2335556948585278133ec63bd1.tar.xz
dexon-sol-tools-4181a040b5d5ca2335556948585278133ec63bd1.tar.zst
dexon-sol-tools-4181a040b5d5ca2335556948585278133ec63bd1.zip
feat: refactor out overlay component and use it to implement click-outside
Diffstat (limited to 'packages/instant/src/components/ui/overlay.tsx')
-rw-r--r--packages/instant/src/components/ui/overlay.tsx28
1 files changed, 10 insertions, 18 deletions
diff --git a/packages/instant/src/components/ui/overlay.tsx b/packages/instant/src/components/ui/overlay.tsx
index f1706c874..64090a6b3 100644
--- a/packages/instant/src/components/ui/overlay.tsx
+++ b/packages/instant/src/components/ui/overlay.tsx
@@ -1,38 +1,30 @@
import * as _ from 'lodash';
import * as React from 'react';
-import { ColorOption, overlayBlack, styled } from '../../style/theme';
-
-import { Container } from './container';
-import { Flex } from './flex';
-import { Icon } from './icon';
+import { overlayBlack, styled } from '../../style/theme';
+import { zIndex } from '../../style/z_index';
export interface OverlayProps {
- className?: string;
- onClose?: () => void;
zIndex?: number;
+ backgroundColor?: string;
}
-const PlainOverlay: React.StatelessComponent<OverlayProps> = ({ children, className, onClose }) => (
- <Flex height="100vh" className={className}>
- <Container position="absolute" top="0px" right="0px">
- <Icon height={18} width={18} color={ColorOption.white} icon="closeX" onClick={onClose} padding="2em 2em" />
- </Container>
- <div>{children}</div>
- </Flex>
-);
-export const Overlay = styled(PlainOverlay)`
+export const Overlay =
+ styled.div <
+ OverlayProps >
+ `
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: ${props => props.zIndex}
- background-color: ${overlayBlack};
+ background-color: ${props => props.backgroundColor};
`;
Overlay.defaultProps = {
- zIndex: 100,
+ zIndex: zIndex.overlayDefault,
+ backgroundColor: overlayBlack,
};
Overlay.displayName = 'Overlay';