Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions src/components/Share/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React, { Component, PropTypes } from 'react';
const Style = require('./style.scss');
export default class Share extends Component {


static propTypes = {
surah: PropTypes.object.isRequired
};


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

render() {

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

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

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

<i
onClick={() => this.onClickPopup(`https://twitter.com/intent/tweet?url=${surahUrl}&text=Surat ${name.simple}`, 'Twitter')}
className={`${Style.iconContainer} ${Style.twitter}`}
data-metrics-event-name="Share:Twitter"
title="Share on Twitter"
>
</i>

</div>
);
}
}
34 changes: 34 additions & 0 deletions src/components/Share/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.shareContainer {
position: relative;
bottom: 2px;
left: 5px;

.iconContainer {
padding: 0 30px 10px 0;
}

.facebook {
background-image: url(../../../static/images/FB-grn.png);
background-repeat: no-repeat;

background-size: 12px;
padding-top: 1px;

&:hover {
background-image: url(../../../static/images/FB-beige.png);
}
}

.twitter {
background-image: url(../../../static/images/Twitter-grn.png);
background-repeat: no-repeat;
background-size: 21px;

&:hover {
background-image: url(../../../static/images/Twitter-beige.png);
}
}

}


6 changes: 5 additions & 1 deletion src/containers/Surah/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import Ayah from 'components/Ayah';
import Line from 'components/Line';
import SearchInput from 'components/SearchInput';
import Bismillah from 'components/Bismillah';
import Share from 'components/Share';

// utils
import scroller from 'utils/scroller';
Expand Down Expand Up @@ -407,7 +408,7 @@ export default class Surah extends Component {
}

renderTopOptions() {
const { toggleReadingMode, options } = this.props; // eslint-disable-line no-shadow
const { toggleReadingMode, options, surah } = this.props; // eslint-disable-line no-shadow

return (
<Row>
Expand All @@ -433,6 +434,9 @@ export default class Surah extends Component {
onReadingModeToggle={toggleReadingMode}
/>
</li>
<li>|</li>
<li><Share surah={surah}/></li>

</ul>
</Col>
</Row>
Expand Down
3 changes: 3 additions & 0 deletions src/helpers/Html.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ const Html = ({ store, component, assets }) => {
{head.script.toComponent()}
{head.style.toComponent()}

<script dangerouslySetInnerHTML={{__html: `/*<![CDATA[*/window.zEmbed||function(e,t){var n,o,d,i,s,a=[],r=document.createElement("iframe");window.zEmbed=function(){a.push(arguments)},window.zE=window.zE||window.zEmbed,r.src="javascript:false",r.title="",r.role="presentation",(r.frameElement||r).style.cssText="display: none",d=document.getElementsByTagName("script"),d=d[d.length-1],d.parentNode.insertBefore(r,d),i=r.contentWindow,s=i.document;try{o=s}catch(c){n=document.domain,r.src='javascript:var d=document.open();d.domain="'+n+'";void(0);',o=s}o.open()._l=function(){var o=this.createElement("script");n&&(this.domain=n),o.id="js-iframe-async",o.src=e,this.t=+new Date,this.zendeskHost=t,this.zEQueue=a,this.body.appendChild(o)},o.write('<body onload="document._l();">'),o.close()}("https://assets.zendesk.com/embeddable_framework/main.js","quran.zendesk.com");
/*]]>*/`}} />

{Object.keys(assets.styles).map((style, i) => (
<link
href={assets.styles[style]}
Expand Down
2 changes: 1 addition & 1 deletion src/styles/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ $tracker-height-hundred-boolean: false;

$font-family-sans-serif: 'Montserrat', sans-serif;
$font-montserrat: $font-family-sans-serif;

$font-awesome: 'FontAwesome', serif;
$icon-font-path: "bootstrap-sass/assets/fonts";

@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap/variables";