Skip to content

Commit

Permalink
quran#341 spelling mistake + slight refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
thabti committed Jul 2, 2016
1 parent 9763333 commit d4046dd
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/components/Share/index.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
import React, { Component } from 'react'
import Style from './style.scss'

let Style = require('./style.scss');
export default class Share extends Component {

onClickPopup(url, title) {
window.open(url, title, `width=670,height=540,scrollbars=no,toolbar=0`);
}

render() {

let {surahId, name} = this.props.surah;
let url = encodeURIComponent(`http://quran.com/${surahId}`);

let facebookUl = `https://www.facebook.com/sharer/sharer.php?u=${url}`;
let twitterUrl = `https://twitter.com/intent/tweet?url=${url}&text=Surat ${name.simple}`;
let surahUrl = encodeURIComponent(`http://quran.com/${surahId}`);

return (
<div className={Style.share}>

<i onClick={()=> this.onClickPopup(facebookUl, "Facebook")}
<i onClick={()=> this.onClickPopup(`https://www.facebook.com/sharer/sharer.php?u=${surahUrl}`, "Facebook")}
className={Style.facebook}
data-metrics-event-name="Share:Facebook"
title="Share on Facebook"></i>

<i onClick={()=> this.onClickPopup(twitterUrl, "Twitter")}
<i onClick={()=> this.onClickPopup(`https://twitter.com/intent/tweet?url=${surahUrl}&text=Surat ${name.simple}`, "Twitter")}
className={Style.twitter}
data-metrics-event-name="Share:Twitter"
title="Share on Twitter"></i>
Expand All @@ -27,9 +29,6 @@ export default class Share extends Component {
)
}

onClickPopup(url, title) {
window.open(url, title, `width=670,height=540,scrollbars=no,toolbar=0`);
}

}

}

0 comments on commit d4046dd

Please sign in to comment.