1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-06-17 18:13:14 +02:00
blog/src/components/atoms/PostActions.jsx

59 lines
1.6 KiB
React
Raw Normal View History

2018-08-29 19:44:31 +02:00
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import ModalThanks from '../molecules/ModalThanks'
import styles from './PostActions.module.scss'
2018-09-24 22:28:07 +02:00
import { ReactComponent as Twitter } from '../../images/twitter.svg'
import { ReactComponent as Bitcoin } from '../../images/bitcoin.svg'
2018-08-29 19:44:31 +02:00
2018-09-06 19:23:34 +02:00
export default class PostActions extends PureComponent {
state = {
showModal: false
}
2018-08-29 19:44:31 +02:00
2018-09-06 19:23:34 +02:00
static propTypes = {
slug: PropTypes.string.isRequired,
url: PropTypes.string.isRequired
2018-08-29 19:44:31 +02:00
}
toggleModal = () => {
this.setState({ showModal: !this.state.showModal })
}
render() {
const { url, slug } = this.props
return (
<aside className={styles.actions}>
<article className={styles.action}>
<Twitter />
<h1 className={styles.actionTitle}>Have a comment?</h1>
<p className={styles.actionText}>
Hit me up{' '}
<a
href={`https://twitter.com/intent/tweet?text=@kremalicious&url=${url}${slug}`}
>
@kremalicious
</a>
</p>
</article>
<article className={styles.action}>
<Bitcoin />
<h1 className={styles.actionTitle}>Found something useful?</h1>
<p className={styles.actionText}>
Say thanks{' '}
2018-10-01 19:57:49 +02:00
<button className="link" onClick={this.toggleModal}>
with Bitcoins or Ether.
</button>
2018-08-29 19:44:31 +02:00
</p>
</article>
<ModalThanks
isOpen={this.state.showModal}
handleCloseModal={this.toggleModal}
/>
</aside>
)
}
}