diff options
author | Samy Pessé <samypesse@gmail.com> | 2017-01-06 21:18:20 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2017-01-06 21:18:20 +0100 |
commit | cc7b2b2181ce35acdd080edc9adbf8cc6b3f93e4 (patch) | |
tree | 08fae13cd8ef338aa758312348952040538dc510 /packages/gitbook-plugin-theme-default/src | |
parent | 4b3ac4e82752694d47a8c2e700a753fb64fec808 (diff) | |
download | gitbook-cc7b2b2181ce35acdd080edc9adbf8cc6b3f93e4.zip gitbook-cc7b2b2181ce35acdd080edc9adbf8cc6b3f93e4.tar.gz gitbook-cc7b2b2181ce35acdd080edc9adbf8cc6b3f93e4.tar.bz2 |
Add divider in summary
Diffstat (limited to 'packages/gitbook-plugin-theme-default/src')
-rw-r--r-- | packages/gitbook-plugin-theme-default/src/components/Summary.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/packages/gitbook-plugin-theme-default/src/components/Summary.js b/packages/gitbook-plugin-theme-default/src/components/Summary.js index ef6ab3f..9109fdc 100644 --- a/packages/gitbook-plugin-theme-default/src/components/Summary.js +++ b/packages/gitbook-plugin-theme-default/src/components/Summary.js @@ -51,14 +51,17 @@ const SummaryArticles = React.createClass({ const SummaryPart = React.createClass({ propTypes: { - part: GitBook.PropTypes.SummaryPart + part: GitBook.PropTypes.SummaryPart, + first: React.PropTypes.bool }, render() { - const { part } = this.props; + const { part, first } = this.props; const { title, articles } = part; - const titleEL = title ? <h2 className="SummaryPart-Title">{title}</h2> : null; + const titleEL = title ? ( + <h2 className="SummaryPart-Title">{title}</h2> + ) : (first ? null : <hr className="SummaryPart-Divider" />); return ( <GitBook.InjectedComponent matching={{ role: 'summary:part' }} props={this.props}> @@ -82,7 +85,7 @@ const SummaryParts = React.createClass({ return ( <GitBook.InjectedComponent matching={{ role: 'summary:parts' }} props={this.props}> <div className="SummaryParts"> - {parts.map((part, i) => <SummaryPart key={i} part={part} />)} + {parts.map((part, i) => <SummaryPart key={i} part={part} first={i == 0} />)} </div> </GitBook.InjectedComponent> ); |