Skip to content

Commit 01cb1e4

Browse files
hramosFacebook Github Bot 4
authored andcommitted
Update Edit on GitHub links to point to master
Summary: We've been getting a lot of documentation PRs opened against `0.29-stable`, `0.30-stable`, and so on, instead of `master`. This is because our doc site is also based on RN release cuts, so clicking on the "Edit on GitHub" links on a document will take you to the markdown source for that release branch instead of the latest doc on `master`. See facebook#9095 for an example of such a PR. In this PR we edit the link to say View on GitHub. Though it may not prevent PRs from being opened against a release branch, removing the "Edit" CTA may help in this regard. Closes facebook#9149 Differential Revision: D3664368 Pulled By: vjeux fbshipit-source-id: 395c0813f736bfbe1be4b4fb1182f9060169365d
1 parent 9fa4fe2 commit 01cb1e4

File tree

7 files changed

+82
-66
lines changed

7 files changed

+82
-66
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ Thanks for submitting a pull request! Please provide enough information so that
22

33
> **Unless you are a React Native release maintainer and cherry-picking an *existing* commit into a current release, ensure your pull request is targeting the `master` React Native branch.**
44
5-
(You can skip this if you're fixing a typo or adding an app to the Showcase.)
6-
75
Explain the **motivation** for making this change. What existing problem does the pull request solve?
86

97
Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The core team will be monitoring for pull requests. When we get one, we'll run s
2121
1. Fork the repo and create your branch from `master`.
2222
2. **Describe your test plan in your commit.** If you've added code that should be tested, add tests!
2323
3. If you've changed APIs, update the documentation.
24-
4. If you've updated the docs, verify the website locally and submit screenshots if applicable
24+
4. If you've updated the docs, verify the website locally and submit screenshots if applicable.
2525

2626
```
2727
$ cd website

website/core/Footer.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*
9+
* @providesModule Footer
10+
*/
11+
12+
var React = require('React');
13+
14+
function getGitHubPath(path) {
15+
return 'https://github.com/facebook/react-native/blob/master/' + path;
16+
}
17+
18+
var Footer = React.createClass({
19+
render: function() {
20+
return (
21+
<p className="edit-page-block">
22+
You can <a target="_blank" href={getGitHubPath(this.props.path)}>edit the content above on GitHub</a> and send us a pull request!
23+
</p>
24+
);
25+
}
26+
});
27+
28+
module.exports = Footer;

website/core/HeaderWithGithub.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,8 @@
1212
var H = require('Header');
1313
var React = require('React');
1414

15-
function getVersionedGithubPath(path, version) {
16-
version = version || 'next';
17-
return [
18-
'https://github.com/facebook/react-native/blob',
19-
version === 'next' ? 'master' : version + '-stable',
20-
path
21-
].join('/');
15+
function getGitHubPath(path) {
16+
return 'https://github.com/facebook/react-native/blob/master/' + path;
2217
}
2318

2419
var HeaderWithGithub = React.createClass({
@@ -40,7 +35,7 @@ var HeaderWithGithub = React.createClass({
4035
<td style={{textAlign: 'right'}}>
4136
<a
4237
target="_blank"
43-
href={getVersionedGithubPath(this.props.path, this.context.version)}>
38+
href={getGitHubPath(this.props.path)}>
4439
Edit on GitHub
4540
</a>
4641
</td>

website/layout/AutodocsLayout.js

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
'use strict';
1313

1414
var DocsSidebar = require('DocsSidebar');
15-
var H = require('Header');
1615
var Header = require('Header');
1716
var HeaderWithGithub = require('HeaderWithGithub');
17+
var Footer = require('Footer');
1818
var Marked = require('Marked');
1919
var Prism = require('Prism');
2020
var React = require('React');
@@ -331,7 +331,7 @@ var ComponentDoc = React.createClass({
331331
}
332332
return (
333333
<span>
334-
<H level={3}>Methods</H>
334+
<Header level={3}>Methods</Header>
335335
<div className="props">
336336
{methods.filter((method) => {
337337
return method.name[0] !== '_';
@@ -362,7 +362,7 @@ var ComponentDoc = React.createClass({
362362
}
363363
return (
364364
<span>
365-
<H level={3}>Type Definitions</H>
365+
<Header level={3}>Type Definitions</Header>
366366
<div className="props">
367367
{typedefs.map((typedef) => {
368368
return this.renderTypeDef(typedef, namedTypes);
@@ -381,7 +381,7 @@ var ComponentDoc = React.createClass({
381381
<Marked>
382382
{content.description}
383383
</Marked>
384-
<H level={3}>Props</H>
384+
<Header level={3}>Props</Header>
385385
{this.renderProps(content.props, content.composes)}
386386
{this.renderMethods(content.methods, namedTypes)}
387387
{this.renderTypeDefs(content.typedef, namedTypes)}
@@ -413,7 +413,7 @@ var APIDoc = React.createClass({
413413
}
414414
return (
415415
<span>
416-
<H level={3}>Methods</H>
416+
<Header level={3}>Methods</Header>
417417
<div className="props">
418418
{methods.filter((method) => {
419419
return method.name[0] !== '_';
@@ -447,7 +447,7 @@ var APIDoc = React.createClass({
447447
}
448448
return (
449449
<span>
450-
<H level={3}>Properties</H>
450+
<Header level={3}>Properties</Header>
451451
<div className="props">
452452
{properties.filter((property) => {
453453
return property.name[0] !== '_';
@@ -508,7 +508,7 @@ var APIDoc = React.createClass({
508508
}
509509
return (
510510
<span>
511-
<H level={3}>Type Definitions</H>
511+
<Header level={3}>Type Definitions</Header>
512512
<div className="props">
513513
{typedefs.map((typedef) => {
514514
return this.renderTypeDef(typedef, namedTypes);
@@ -835,13 +835,11 @@ var Autodocs = React.createClass({
835835
}
836836
return (
837837
<div>
838-
<HeaderWithGithub
839-
title="Description"
840-
path={'docs/' + docs.componentName + '.md'}
841-
/>
838+
<Header level={1}>Description</Header>
842839
<Marked>
843840
{docs.fullDescription}
844841
</Marked>
842+
<Footer path={'docs/' + docs.componentName + '.md'} />
845843
</div>
846844
);
847845
},
@@ -876,7 +874,7 @@ var Autodocs = React.createClass({
876874

877875
return (
878876
<div>
879-
{(docs.examples.length > 1) ? <H level={3}>Examples</H> : null}
877+
{(docs.examples.length > 1) ? <Header level={3}>Examples</Header> : null}
880878
{docs.examples.map(example => this.renderExample(example, metadata))}
881879
</div>
882880
);
@@ -895,12 +893,9 @@ var Autodocs = React.createClass({
895893
<DocsSidebar metadata={metadata} />
896894
<div className="inner-content">
897895
<a id="content" />
898-
<HeaderWithGithub
899-
title={metadata.title}
900-
level={1}
901-
path={metadata.path}
902-
/>
896+
<Header level={1}>{metadata.title}</Header>
903897
{content}
898+
<Footer path={metadata.path} />
904899
{this.renderFullDescription(docs)}
905900
{this.renderExamples(docs, metadata)}
906901
<div className="docs-prevnext">

website/layout/DocsLayout.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
*/
1111

1212
var DocsSidebar = require('DocsSidebar');
13-
var HeaderWithGithub = require('HeaderWithGithub');
13+
var Header = require('Header');
14+
var Footer = require('Footer');
1415
var Marked = require('Marked');
1516
var React = require('React');
1617
var Site = require('Site');
@@ -38,16 +39,13 @@ var DocsLayout = React.createClass({
3839
<DocsSidebar metadata={metadata} />
3940
<div className="inner-content">
4041
<a id="content" />
41-
<HeaderWithGithub
42-
title={metadata.title}
43-
level={1}
44-
path={'docs/' + metadata.filename}
45-
/>
42+
<Header level={1}>{metadata.title}</Header>
4643
<Marked>{content}</Marked>
4744
<div className="docs-prevnext">
4845
{metadata.previous && <a className="docs-prev" href={'docs/' + metadata.previous + '.html#content'}>&larr; Prev</a>}
4946
{metadata.next && <a className="docs-next" href={'docs/' + metadata.next + '.html#content'}>Next &rarr;</a>}
5047
</div>
48+
<Footer path={'docs/' + metadata.filename} />
5149
<div className="survey">
5250
<div className="survey-image" />
5351
<p>

website/src/react-native/css/react-native.css

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -834,8 +834,8 @@ h2 {
834834
}
835835

836836
.docs-prevnext {
837-
padding-top: 40px;
838-
padding-bottom: 40px;
837+
padding-top: 20px;
838+
padding-bottom: 20px;
839839
}
840840

841841
.button {
@@ -1580,56 +1580,58 @@ input#algolia-doc-search:focus {
15801580
color: #3B3738;
15811581
}
15821582

1583-
.params, .props
1584-
{
1585-
border-spacing: 0;
1586-
border: 0;
1587-
border-collapse: collapse;
1583+
.params, .props {
1584+
border-spacing: 0;
1585+
border: 0;
1586+
border-collapse: collapse;
15881587
}
15891588

15901589
.params .name, .props .name, .name code {
1591-
color: #4D4E53;
1590+
color: #4D4E53;
15921591
}
15931592

1594-
.params td, .params th, .props td, .props th
1595-
{
1596-
border: 1px solid #ddd;
1597-
margin: 0px;
1598-
text-align: left;
1599-
vertical-align: top;
1600-
padding: 4px 6px;
1601-
display: table-cell;
1593+
.params td, .params th, .props td, .props th {
1594+
border: 1px solid #ddd;
1595+
margin: 0px;
1596+
text-align: left;
1597+
vertical-align: top;
1598+
padding: 4px 6px;
1599+
display: table-cell;
16021600
}
16031601

1604-
.params thead tr, .props thead tr
1605-
{
1606-
background-color: hsl(198, 75%, 88%);
1607-
font-weight: bold;
1602+
.params thead tr, .props thead tr {
1603+
background-color: hsl(198, 75%, 88%);
1604+
font-weight: bold;
16081605
}
16091606

1610-
.params .params thead tr, .props .props thead tr
1611-
{
1612-
background-color: #fff;
1613-
font-weight: bold;
1607+
.params .params thead tr, .props .props thead tr {
1608+
background-color: #fff;
1609+
font-weight: bold;
16141610
}
16151611

16161612
.params th, .props th { border-right: 1px solid #aaa; }
16171613
.params thead .last, .props thead .last { border-right: 1px solid #ddd; }
16181614

16191615
.params td.description > div > p:first-child,
1620-
.props td.description > div > p:first-child
1621-
{
1622-
margin-top: 0;
1623-
padding-top: 0;
1616+
.props td.description > div > p:first-child {
1617+
margin-top: 0;
1618+
padding-top: 0;
16241619
}
16251620

16261621
.params td.description > p:last-child,
1627-
.props td.description > p:last-child
1628-
{
1629-
margin-bottom: 0;
1630-
padding-bottom: 0;
1622+
.props td.description > p:last-child {
1623+
margin-bottom: 0;
1624+
padding-bottom: 0;
16311625
}
16321626

1627+
.edit-page-block {
1628+
padding: 5px;
1629+
margin-bottom: 40px;
1630+
font-size: 12px;
1631+
color: #887766;
1632+
text-align: center;
1633+
background-color: rgba(5, 165, 209, 0.05);
1634+
}
16331635

16341636
/** Web player **/
16351637

0 commit comments

Comments
 (0)