Skip to content

Commit

Permalink
feat: improve <Overlay>
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Feb 13, 2018
1 parent 6b3bfbe commit 67186ca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/Overlay/__story__/story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {linkTo} from '@storybook/addon-links';
import {Overlay} from '..';
import ShowDocs from '../../../.storybook/ShowDocs'

storiesOf('Other/Overlay', module)
storiesOf('UI/Overlay', module)
.add('Documentation', () => h(ShowDocs, {md: require('../../../docs/en/Overlay.md')}))
.add('Basic example', () =>
<div>
Expand Down Expand Up @@ -64,3 +64,10 @@ storiesOf('Other/Overlay', module)
</Overlay>
</div>
)
.add('No animation', () =>
<div>
<Overlay time={0}>
foobar
</Overlay>
</div>
)
6 changes: 4 additions & 2 deletions src/Overlay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import {h} from '../util';

export interface IOverlayProps {
color?: string;
time?: number;
}

export interface IOverlayState {
}

export class Overlay extends Component<IOverlayProps, IOverlayState> {
static defaultProps = {
color: 'rgba(0,0,0,0.5)'
color: 'rgba(0,0,0,0.5)',
time: 300,
};

onElement = (el) => {
Expand All @@ -26,7 +28,7 @@ export class Overlay extends Component<IOverlayProps, IOverlayState> {
style.right = 0;
style.bottom = 0;
style.background = this.props.color;
style.transition = '0.3s opacity';
style.transition = this.props.time + 'ms opacity';
style.opacity = 0;

style.display = 'flex';
Expand Down

0 comments on commit 67186ca

Please sign in to comment.