This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implementation of the overlay component (#527)
- Loading branch information
1 parent
9794b86
commit 7a2cd00
Showing
5 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as React from 'react'; | ||
import DemoContainer from '../demo-container'; | ||
|
||
import { Copy, CopySize } from '../copy'; | ||
import { Icon, IconName, IconSize } from '../icons'; | ||
import { Overlay } from './index'; | ||
import { Space, SpaceSize } from '../space'; | ||
|
||
const DemoOverlay: React.StatelessComponent<void> = (): JSX.Element => ( | ||
<DemoContainer> | ||
<Overlay isVisisble={true}> | ||
<Space size={[0, 0, SpaceSize.L]}> | ||
<Icon name={IconName.Robo} size={IconSize.S} /> | ||
</Space> | ||
<Copy size={CopySize.M}>Drop the component on the left element list</Copy> | ||
</Overlay> | ||
</DemoContainer> | ||
); | ||
|
||
export default DemoOverlay; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
import { Color } from '../colors'; | ||
import { getSpace, SpaceSize } from '../space'; | ||
|
||
export interface OverlayProps { | ||
isVisisble: boolean; | ||
} | ||
|
||
export interface StyledOverlayProps { | ||
isVisisble: boolean; | ||
} | ||
|
||
const StyledOverlay = styled.div` | ||
position: fixed; | ||
top: 50%; | ||
left: 50%; | ||
box-sizing: border-box; | ||
width: 20vw; | ||
min-width: 200px; | ||
max-width: 500px; | ||
padding: ${getSpace(SpaceSize.XL)}px ${getSpace(SpaceSize.XXL)}px; | ||
border-radius: 3px; | ||
box-shadow: 0 1px 6px ${Color.Grey60}; | ||
opacity: ${(props: StyledOverlayProps) => (props.isVisisble ? 1 : 0)}; | ||
text-align: center; | ||
pointer-events: ${(props: StyledOverlayProps) => (props.isVisisble ? 'auto' : 'none')}; | ||
background-color: ${Color.Grey97}; | ||
transform: translate(-50%, -50%); | ||
transition: opacity 0.333s ease; | ||
`; | ||
|
||
export const Overlay: React.StatelessComponent<OverlayProps> = ({ | ||
children, | ||
isVisisble | ||
}): JSX.Element => <StyledOverlay isVisisble={isVisisble}>{children}</StyledOverlay>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "overlay", | ||
"displayName": "Overlay", | ||
"flag": "alpha", | ||
"version": "1.0.0", | ||
"tags": ["overlay"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters