Skip to content

Instantly share code, notes, and snippets.

@sebassdc
Created October 9, 2018 01:25
Show Gist options
  • Save sebassdc/514ac50af47a23cf247d20bba81ef8c2 to your computer and use it in GitHub Desktop.
Save sebassdc/514ac50af47a23cf247d20bba81ef8c2 to your computer and use it in GitHub Desktop.
Smooth behavior
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