import * as React from "react" import { injectGlobal } from "styled-components" // tslint:disable-next-line:no-unused-expression injectGlobal` .AnchorWithAnimate { position: absolute; left:0; top:0; right:0; bottom:0; } @keyframes fadeZoomIn { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.2); opacity: 0; } } .fadeZoomIn { transition: 0.3333s ease-out transform, 0.4444s ease-out opacity; animation: fadeZoomIn 0.4444s 1; white-space: nowrap; z-index:1; } ` interface AWithDelayPropTypes extends React.AnchorHTMLAttributes { href: string } export default class AWithZoomDelay extends React.Component { constructor(props) { super(props) this.state = { active: false } } public handleClick = (e: React.MouseEvent) => { if (!this.props.onClick) { return } this.props.onClick(e) this.setState({ active: true }) e.preventDefault() setTimeout(() => { window.location.href = this.props.href }, 444) } public render() { return ( {this.props.children} {this.state.active ?
{this.props.children}
: null}
) } }