Skip to content

Commit

Permalink
add doc edit link (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkholic authored and arunoda committed Oct 24, 2016
1 parent ecda62a commit 2c8fa2d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/components/Docs/Container/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class Container extends React.Component {
selectedItemId
} = this.props;

const gitHubRepoUrl = 'https://github.com/kadirahq/getstorybook.io';
const docPath = `${selectedCatId}/${selectedSectionId}/${selectedItemId}`;
const gitHubRepoDocUrl = `${gitHubRepoUrl}/tree/master/src/docs/${docPath}.js`;

return (
<div id="docs-container" className="row">
<div className="row">
Expand Down Expand Up @@ -59,6 +63,7 @@ class Container extends React.Component {
<Content
title={selectedItem.title}
content={selectedItem.content}
editUrl={gitHubRepoDocUrl}
/>

<div className="nav-dropdown">
Expand Down
5 changes: 4 additions & 1 deletion src/components/Docs/Content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ marked.setOptions({
smartypants: false
});

const DocsContent = ({ title, content }) => (
const DocsContent = ({ title, content, editUrl }) => (
<div id="docs-content">
<div className="content">
<h2 className="title">{ title }</h2>
<p><a className="edit-link" href={editUrl} target="_blank">Edit this page</a></p>

<div className="markdown">
<Highlight>
{ marked(content) }
Expand All @@ -31,6 +33,7 @@ const DocsContent = ({ title, content }) => (
DocsContent.propTypes = {
title: React.PropTypes.string,
content: React.PropTypes.string.isRequired,
editUrl: React.PropTypes.string,
};

export default DocsContent;
9 changes: 8 additions & 1 deletion src/components/Docs/Content/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@
#docs-content .title {
font-size: 25px;
color: rgb(0, 0, 0);
margin-bottom: 30px;
margin-bottom: 0;
line-height: 28px;
font-weight: 800;
}

#docs-content a.edit-link {
color: #E25E5E !important;
font-size: 11px;
text-transform: uppercase;
font-weight: bold;
}

#docs-content .markdown div,
#docs-content .markdown p,
#docs-content .markdown li,
Expand Down

0 comments on commit 2c8fa2d

Please sign in to comment.