Skip to content
Closed
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
7 changes: 4 additions & 3 deletions website/core/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<H {...this.props}>
<a className="anchor" name={slug}></a>
{this.props.children}
{' '}<a className="hash-link" href={this.props.permalink + '#' + slug}>#</a>
{' '}<a className="hash-link" href={base + '#' + slug}>#</a>
</H>
);
}
Expand Down
12 changes: 10 additions & 2 deletions website/layout/AutodocsLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ var ComponentDoc = React.createClass({
renderProp: function(name, prop) {
return (
<div className="prop" key={name}>
<Header level={4} className="propTitle" toSlug={name} permalink={this.props.permalink}>
<Header level={4} className="propTitle" toSlug={name}>
{prop.platforms && prop.platforms.map(platform =>
<span className="platform">{platform}</span>
)}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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' ?
<ComponentDoc content={docs} permalink={metadata.permalink}/> :
<ComponentDoc content={docs} /> :
<APIDoc content={docs} apiName={metadata.title} />;

return (
Expand Down
8 changes: 8 additions & 0 deletions website/layout/DocsLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions website/layout/PageLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions website/src/react-native/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Site section="support" title="Support">
Expand Down