Sha256: 6f3009772bf6b1b5090e1041e38eb116cb5d0967c2298bf0abb1716482a56bb2

Contents?: true

Size: 717 Bytes

Versions: 2

Compression:

Stored size: 717 Bytes

Contents

import React from 'react';

export default class PageLink extends React.Component {
  render() {
    return (
      <a href={this._href()}
         className={this.props.className}
         onClick={this._handleClick.bind(this)}>
        {this.props.children}
      </a>
    );
  }

  _href() {
    if (this._targetPage()) {
      return '#' + this._targetPage().permaId;
    }
    else {
      return '#missing';
    }
  }

  _handleClick(event) {
    if (this._targetPage()) {
      pageflow.slides.goToByPermaId(this._targetPage().permaId, {
        transition: this.props.pageLink.pageTransition
      });
    }
    event.preventDefault();
  }

  _targetPage() {
    return this.props.pageLink.targetPage;
  }
};

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pageflow-react-0.1.1 js/src/components/page_link.jsx
pageflow-react-0.1.0 js/src/components/page_link.jsx