now with translations and page hostname

This commit is contained in:
Riley Davis
2016-11-11 13:17:18 -07:00
parent 8369f09bda
commit 4b6bf58d43
2 changed files with 18 additions and 2 deletions
@@ -1,7 +1,11 @@
import React, {PropTypes} from 'react';
import I18n from 'coral-framework/i18n/i18n';
import translations from './translations';
import onClickOutside from 'react-onclickoutside';
const name = 'coral-plugin-permalinks';
const lang = new I18n(translations);
class PermalinkButton extends React.Component {
static propTypes = {
@@ -39,13 +43,13 @@ class PermalinkButton extends React.Component {
}
render () {
const publisherUrl = 'http://nytimes.com/';
const publisherUrl = `${location.protocol}//${location.host}/`;
return (
<div className={`${name}-container`} style={styles}>
<button onClick={this.toggle} className={`${name}-button`}>
<i className={`${name}-icon material-icons`} aria-hidden={true}>link</i>
Permalink
{lang.t('permalink.permalink')}
</button>
<div
style={styles.popover(this.state.popoverOpen)}
@@ -0,0 +1,12 @@
export default {
en: {
permalink: {
permalink: 'Permalink'
}
},
es: {
permalink: {
permalink: 'Enlace permanente'
}
}
};