Skip to content

Instantly share code, notes, and snippets.

@christiannwamba
Created May 30, 2018 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christiannwamba/17135efdf487a474a69f3e58df3b246d to your computer and use it in GitHub Desktop.
Save christiannwamba/17135efdf487a474a69f3e58df3b246d to your computer and use it in GitHub Desktop.
//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