Skip to content

Commit

Permalink
resolved the broken links for all components method in page linking
Browse files Browse the repository at this point in the history
Summary:
Fixed facebook#12327

- Run the website locally
- Navigate to: http://localhost:8079/react-native/docs/statusbar.html
- Click the StatusBarAnimation and the StatusBarStyle in the Method section
- The links will now go to the correct in page anchor tags instead of the getting started page

The `website/layout/*.js` files could use some serious love.  I would really like the opportunity to do that with the react team I run.  Let me know :)
Closes facebook#14028

Differential Revision: D5478418

Pulled By: hramos

fbshipit-source-id: b565847da3c280466ed088fd820b5bfe0474bba0
  • Loading branch information
jordanpapaleo authored and facebook-github-bot committed Jul 23, 2017
1 parent 8dea90b commit 7aec6ae
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions website/layout/AutodocsLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ var ComponentDoc = React.createClass({
examples={method.examples}
returns={method.returns}
namedTypes={namedTypes}
entityName={this.props.componentName}
/>
);
},
Expand Down Expand Up @@ -409,7 +410,6 @@ var ComponentDoc = React.createClass({
});

var APIDoc = React.createClass({

renderMethod: function(method, namedTypes) {
return (
<Method
Expand All @@ -419,7 +419,7 @@ var APIDoc = React.createClass({
params={method.params}
modifiers={method.scope ? [method.scope] : method.modifiers}
examples={method.examples}
apiName={this.props.apiName}
entityName={this.props.apiName}
namedTypes={namedTypes}
/>
);
Expand Down Expand Up @@ -634,6 +634,7 @@ var Method = React.createClass({
if (!foundDescription) {
return null;
}

return (
<div>
<strong>Parameters:</strong>
Expand All @@ -651,7 +652,7 @@ var Method = React.createClass({
<td>
{param.optional ? '[' + param.name + ']' : param.name}
<br/><br/>
{renderTypeWithLinks(param.type, this.props.apiName, this.props.namedTypes)}
{renderTypeWithLinks(param.type, this.props.entityName, this.props.namedTypes)}
</td>
<td className="description"><Marked>{param.description}</Marked></td>
</tr>
Expand Down Expand Up @@ -816,9 +817,9 @@ var Autodocs = React.createClass({
render: function() {
var metadata = this.props.metadata;
var docs = JSON.parse(this.props.children);
var content = docs.type === 'component' || docs.type === 'style' ?
<ComponentDoc content={docs} /> :
<APIDoc content={docs} apiName={metadata.title} />;
var content = docs.type === 'component' || docs.type === 'style'
? <ComponentDoc content={docs} componentName={metadata.title} />
: <APIDoc content={docs} apiName={metadata.title} />;

return (
<Site
Expand Down

0 comments on commit 7aec6ae

Please sign in to comment.