项目作者: FDMediagroep

项目描述 :
ReactJS Anchor component
高级语言: TypeScript
项目地址: git://github.com/FDMediagroep/fdmg-ts-react-anchor.git
创建时间: 2017-11-27T13:22:22Z
项目社区:https://github.com/FDMediagroep/fdmg-ts-react-anchor

开源协议:

下载


:exclamation: DEPRECATED :exclamation: : Superseded by @fdmg/design-system. See: https://github.com/FDMediagroep/fd-design-system

fdmg-ts-react-anchor

Build Status
Coverage Status
npm version
Greenkeeper badge

ReactJS Anchor component. This component renders an Anchor header.
You might think it silly to have this as a separate component. But when you use an Anchor-element multiple times in your
project then having that as a component might eventually save you some bytes.

Installation

  • Run npm i --save-dev @fdmg/ts-react-anchor

or

  • Run yarn add @fdmg/ts-react-anchor --dev

Usage

TypeScript

  1. import * as React from 'react';
  2. import A from 'fdmg-ts-react-anchor';
  3. export default class foo {
  4. public state: any;
  5. public props: any;
  6. constructor(props: any) {
  7. super(props);
  8. this.props = props;
  9. }
  10. render() {
  11. return (<span>
  12. <A className={'css-class-name'}>Anchor text</A>
  13. <A className={'css-class-name'} title='Title text'>Anchor text</A>
  14. <A className={'css-class-name'} ariaLabel='ARIA-label text'>Anchor text</A>
  15. <A className={'css-class-name'} title='Title text' ariaLabel='ARIA-label text'>Anchor text</A>
  16. <A href="https://fd.nl"
  17. className={'css-class-name'}
  18. title='Title text'
  19. ariaLabel='ARIA-label text'
  20. target="_blank"
  21. tabIndex='2'>Anchor text</A>
  22. </span>);
  23. }
  24. }

Resulting HTML

  1. <span>
  2. <a class="css-class-name" aria-label="Anchor text" tabIndex="0">Anchor text</a>
  3. <a class="css-class-name" aria-label="Title text" tabIndex="0">Anchor text</a>
  4. <a class="css-class-name" aria-label="ARIA-label text" tabIndex="0">Anchor text</a>
  5. <a class="css-class-name" aria-label="ARIA-label text" tabIndex="0">Anchor text</a>
  6. <a href="https://fd.nl" class="css-class-name" aria-label="ARIA-label text" target="_blank" tabIndex="2">Anchor text</a>
  7. </span>