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

57 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}>
2018-10-14 13:59:18 +02:00
<a
className={styles.action}
href={`https://twitter.com/intent/tweet?text=@kremalicious&url=${url}${slug}`}
>
2018-08-29 19:44:31 +02:00
<Twitter />
<h1 className={styles.actionTitle}>Have a comment?</h1>
<p className={styles.actionText}>
2018-10-14 13:59:18 +02:00
Hit me up <span className={styles.link}>@kremalicious</span>.
2018-08-29 19:44:31 +02:00
</p>
2018-10-14 13:59:18 +02:00
</a>
<button className={styles.action} onClick={this.toggleModal}>
2018-08-29 19:44:31 +02:00
<Bitcoin />
<h1 className={styles.actionTitle}>Found something useful?</h1>
<p className={styles.actionText}>
Say thanks{' '}
2018-10-14 13:59:18 +02:00
<span className={styles.link}>with Bitcoins or Ether</span>.
2018-08-29 19:44:31 +02:00
</p>
2018-10-14 13:59:18 +02:00
</button>
2018-08-29 19:44:31 +02:00
2018-10-09 23:48:25 +02:00
{this.state.showModal && (
<ModalThanks
isOpen={this.state.showModal}
handleCloseModal={this.toggleModal}
/>
)}
2018-08-29 19:44:31 +02:00
</aside>
)
}
}