This package has been deprecated

Author message:

This package has been deprecated. Please find this package under its new name @cloudflare/component-link.

cf-component-link

6.0.0 • Public • Published

cf-component-link

Cloudflare Link Component

Installation

Installation with yarn is recommended

 
$ yarn add cf-component-link
 

Usage

import React from 'react';
import { Link } from 'cf-component-link';
 
class LinkComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      isActive: false
    };
  }
 
  handleClick() {
    console.log('handleClick!');
  }
 
  handleExpandedClick() {
    this.setState({ isActive: !this.state.isActive });
  }
 
  render() {
    return (
      <div>
        <p>
          Create a <code>Link</code> with a <code>to</code> prop:
        </p>
        <Link to="/">Link to /</Link>
 
        <p>
          Alternatively you can pass an <code>onClick</code> handler:
        </p>
        <Link onClick={this.handleClick.bind(this)}>Link to something</Link>
        <p>{`Note: This will give it a role="button"`}</p>
 
        <p>
          All additional props will be added to the <code>Link</code> element:
        </p>
        <Link to="/foo">Link to /foo</Link>
 
        <p>You can create an expandable link by giving it an expandable prop</p>
        <Link
          onClick={this.handleExpandedClick.bind(this)}
          isActive={this.state.isActive}
          expandable
        >
          Link to /foo
        </Link>
      </div>
    );
  }
}
 
export default LinkComponent;
 

Readme

Keywords

none

Package Sidebar

Install

npm i cf-component-link

Weekly Downloads

242

Version

6.0.0

License

BSD-3-Clause

Unpacked Size

24.7 kB

Total Files

9

Last publish

Collaborators

  • lerwincf
  • lbarthonet
  • cf-media-manager
  • jacobbednarz
  • celso
  • cf-radar
  • dash_service_account
  • g4brym
  • snigdha34
  • wrangler-publisher
  • marksteyn
  • chiminator
  • sgoodhew_cf
  • terinjokes
  • third774
  • jsteinberger
  • jasnell
  • asapzacy
  • pcostanzo
  • gregbrimble
  • geelen
  • rexscaria
  • dcruz_cf
  • xuranwang
  • jculvey
  • sejoker
  • vasturiano
  • cf-ci-write
  • segments-write
  • thibmeu
  • xortive
  • gurjinder
  • cf-ci2
  • lvalenta
  • worenga