Port scroll improvements
This commit is contained in:
@ -2,7 +2,6 @@ import React from 'react';
|
||||
import remark from 'remark';
|
||||
import remarkHTML from 'remark-html';
|
||||
import remarkHighlight from 'remark-highlight.js';
|
||||
import Waypoint from 'react-waypoint';
|
||||
import PureRenderMixin from 'react-pure-render/mixin';
|
||||
|
||||
function renderHighlighted(nodes) {
|
||||
@ -22,33 +21,20 @@ function renderHighlighted(nodes) {
|
||||
var Section = React.createClass({
|
||||
mixins: [PureRenderMixin],
|
||||
propTypes: {
|
||||
chunk: React.PropTypes.object.isRequired,
|
||||
onSpy: React.PropTypes.func.isRequired
|
||||
},
|
||||
waypointEnterFromAbove(e, direction) {
|
||||
if (direction === 'above') {
|
||||
this.props.onSpy(this.props.chunk.title);
|
||||
}
|
||||
},
|
||||
waypointEnterFromBelow(e, direction) {
|
||||
if (direction === 'below') {
|
||||
this.props.onSpy(this.props.chunk.title);
|
||||
}
|
||||
chunk: React.PropTypes.object.isRequired
|
||||
},
|
||||
render() {
|
||||
let { chunk } = this.props;
|
||||
let { left, right, preview } = chunk;
|
||||
return (<div className={`contain clearfix ${preview ? 'preview' : ''}`}>
|
||||
<Waypoint onEnter={this.waypointEnterFromBelow} />
|
||||
return (<div
|
||||
title={chunk.title}
|
||||
className={`section pad2y contain clearfix ${preview ? 'preview' : ''}`}>
|
||||
<div
|
||||
className='col6 pad2x prose clip'
|
||||
dangerouslySetInnerHTML={renderHighlighted(left)} />
|
||||
{(right.length > 0) && <div
|
||||
{right.length > 0 && <div
|
||||
className='col6 pad2 prose dark space-top5 clip keyline-top fill-dark'
|
||||
dangerouslySetInnerHTML={renderHighlighted(right)} />}
|
||||
<div className='pin-bottom'>
|
||||
<Waypoint onEnter={this.waypointEnterFromAbove} />
|
||||
</div>
|
||||
</div>);
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user