-
-
Save christiannwamba/17135efdf487a474a69f3e58df3b246d to your computer and use it in GitHub Desktop.
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
//Form.js | |
import React, { Component } from 'react'; | |
import styled from 'styled-components'; | |
import { Motion, spring } from 'react-motion'; | |
import './App.css'; | |
const NotificationBox = styled.div` | |
position: absolute; | |
padding: 1.5em; | |
left: 5%; | |
top: ${(props) => props.top}%; | |
opacity: ${(props) => props.opacity}; | |
font-size: 0.8em; | |
font-weight: bold; | |
border-radius: 5px; | |
background: #81C784; | |
color: white; | |
`; | |
class Form extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
startAnimation: 1 | |
}; | |
this.handleClick = this.handleClick.bind(this); | |
this.resetValue = this.resetValue.bind(this); | |
} | |
handleClick (e){ | |
e.preventDefault(); | |
this.setState({ | |
startAnimation: 0 | |
}) | |
setTimeout(this.resetValue, 2500); | |
} | |
resetValue (){ | |
this.setState({ | |
startAnimation: 1 | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment