diff --git a/website/core/Header.js b/website/core/Header.js index 00de9353cb7855..c83d7334b1b71d 100644 --- a/website/core/Header.js +++ b/website/core/Header.js @@ -13,18 +13,19 @@ var React = require('React'); var slugify = require('slugify'); var Header = React.createClass({ - getDefaultProps: function() { - return {permalink: ''}; + contextTypes: { + permalink: React.PropTypes.string }, render: function() { var slug = slugify(this.props.toSlug || this.props.children); var H = 'h' + this.props.level; + var base = this.context.permalink || ''; return ( {this.props.children} - {' '}# + {' '}# ); } diff --git a/website/layout/AutodocsLayout.js b/website/layout/AutodocsLayout.js index 66bb70018fb9b8..269314cb1e0443 100644 --- a/website/layout/AutodocsLayout.js +++ b/website/layout/AutodocsLayout.js @@ -110,7 +110,7 @@ var ComponentDoc = React.createClass({ renderProp: function(name, prop) { return (
-
+
{prop.platforms && prop.platforms.map(platform => {platform} )} @@ -448,6 +448,14 @@ var Modal = React.createClass({ }); var Autodocs = React.createClass({ + childContextTypes: { + permalink: React.PropTypes.string + }, + + getChildContext: function() { + return {permalink: this.props.metadata.permalink}; + }, + renderFullDescription: function(docs) { if (!docs.fullDescription) { return; @@ -488,7 +496,7 @@ var Autodocs = React.createClass({ var metadata = this.props.metadata; var docs = JSON.parse(this.props.children); var content = docs.type === 'component' || docs.type === 'style' ? - : + : ; return ( diff --git a/website/layout/DocsLayout.js b/website/layout/DocsLayout.js index d92b5d06ebc8db..d84d9682d7a190 100644 --- a/website/layout/DocsLayout.js +++ b/website/layout/DocsLayout.js @@ -16,6 +16,14 @@ var React = require('React'); var Site = require('Site'); var DocsLayout = React.createClass({ + childContextTypes: { + permalink: React.PropTypes.string + }, + + getChildContext: function() { + return {permalink: this.props.metadata.permalink}; + }, + render: function() { var metadata = this.props.metadata; var content = this.props.children; diff --git a/website/layout/PageLayout.js b/website/layout/PageLayout.js index a4ff02c6045849..94697a207d6e79 100644 --- a/website/layout/PageLayout.js +++ b/website/layout/PageLayout.js @@ -14,6 +14,14 @@ var Site = require('Site'); var Marked = require('Marked'); var support = React.createClass({ + childContextTypes: { + permalink: React.PropTypes.string + }, + + getChildContext: function() { + return {permalink: this.props.metadata.permalink}; + }, + render: function() { var metadata = this.props.metadata; var content = this.props.children; diff --git a/website/src/react-native/support.js b/website/src/react-native/support.js index abf51306be9849..de1b4bbe7f4118 100644 --- a/website/src/react-native/support.js +++ b/website/src/react-native/support.js @@ -13,6 +13,13 @@ var center = require('center'); var H2 = require('H2'); var support = React.createClass({ + childContextTypes: { + permalink: React.PropTypes.string + }, + + getChildContext: function() { + return {permalink: 'support.html'}; + }, render: function() { return (