Created
October 9, 2018 01:25
-
-
Save sebassdc/514ac50af47a23cf247d20bba81ef8c2 to your computer and use it in GitHub Desktop.
Smooth behavior
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
export default class extends Component { | |
constructor (props) { | |
super(props) | |
this.element = null | |
} | |
componentDidMount = () => { | |
this.element = document.getElementById(this.props.className) | |
} | |
changeHeight = () => { | |
this.element.scrollIntoView({behavior: 'smooth'}) | |
} | |
render() { | |
return( | |
<div | |
className={`home-role ${this.props.className}`} | |
id={this.props.className} | |
onClick={this.changeHeight} | |
> | |
<img | |
src={this.props.imgUrl} | |
alt="" | |
/> | |
<div className="home-role-card"> | |
<h1>{this.props.title}</h1> | |
<div className="home-role-card-content"> | |
<div className="home-role-p-container"> | |
<p> | |
{this.props.text} | |
</p> | |
</div> | |
<SindyButton>SHOW ME</SindyButton> | |
</div> | |
</div> | |
</div> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment