UNPKG

5.33 kBMarkdownView Raw
1apeman-react-captcha
2==========
3
4<!---
5This file is generated by ape-tmpl. Do not update manually.
6--->
7
8<!-- Badge Start -->
9<a name="badges"></a>
10
11[![Build Status][bd_travis_shield_url]][bd_travis_url]
12[![Code Climate][bd_codeclimate_shield_url]][bd_codeclimate_url]
13[![Code Coverage][bd_codeclimate_coverage_shield_url]][bd_codeclimate_url]
14[![npm Version][bd_npm_shield_url]][bd_npm_url]
15[![JS Standard][bd_standard_shield_url]][bd_standard_url]
16
17[bd_repo_url]: https://github.com/apeman-react-labo/apeman-react-captcha
18[bd_travis_url]: http://travis-ci.org/apeman-react-labo/apeman-react-captcha
19[bd_travis_shield_url]: http://img.shields.io/travis/apeman-react-labo/apeman-react-captcha.svg?style=flat
20[bd_travis_com_url]: http://travis-ci.com/apeman-react-labo/apeman-react-captcha
21[bd_travis_com_shield_url]: https://api.travis-ci.com/apeman-react-labo/apeman-react-captcha.svg?token=
22[bd_license_url]: https://github.com/apeman-react-labo/apeman-react-captcha/blob/master/LICENSE
23[bd_codeclimate_url]: http://codeclimate.com/github/apeman-react-labo/apeman-react-captcha
24[bd_codeclimate_shield_url]: http://img.shields.io/codeclimate/github/apeman-react-labo/apeman-react-captcha.svg?style=flat
25[bd_codeclimate_coverage_shield_url]: http://img.shields.io/codeclimate/coverage/github/apeman-react-labo/apeman-react-captcha.svg?style=flat
26[bd_gemnasium_url]: https://gemnasium.com/apeman-react-labo/apeman-react-captcha
27[bd_gemnasium_shield_url]: https://gemnasium.com/apeman-react-labo/apeman-react-captcha.svg
28[bd_npm_url]: http://www.npmjs.org/package/apeman-react-captcha
29[bd_npm_shield_url]: http://img.shields.io/npm/v/apeman-react-captcha.svg?style=flat
30[bd_standard_url]: http://standardjs.com/
31[bd_standard_shield_url]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
32
33<!-- Badge End -->
34
35
36<!-- Description Start -->
37<a name="description"></a>
38
39apeman react package for captcha component.
40
41<!-- Description End -->
42
43
44<!-- Overview Start -->
45<a name="overview"></a>
46
47
48
49<!-- Overview End -->
50
51
52<!-- Sections Start -->
53<a name="sections"></a>
54
55<!-- Section from "doc/guides/01.Installation.md.hbs" Start -->
56
57<a name="section-doc-guides-01-installation-md"></a>
58
59Installation
60-----
61
62```bash
63$ npm install apeman-react-captcha --save
64```
65
66
67<!-- Section from "doc/guides/01.Installation.md.hbs" End -->
68
69<!-- Section from "doc/guides/02.Demo.md.hbs" Start -->
70
71<a name="section-doc-guides-02-demo-md"></a>
72
73Demo
74-----
75
76[Live demo][demo_url] is hosted on GitHub Pages.
77
78[![Demo Image](./doc/images/screenshot.png)][demo_url]
79
80[demo_url]: http://apeman-react-labo.github.io/apeman-react-captcha/demo/demo.html
81
82
83<!-- Section from "doc/guides/02.Demo.md.hbs" End -->
84
85<!-- Section from "doc/guides/03.Usage.md.hbs" Start -->
86
87<a name="section-doc-guides-03-usage-md"></a>
88
89Usage
90---------
91
92```jsx
93'use strict'
94
95import React from 'react'
96import {ApCaptcha, ApCaptchaStyle} from 'apeman-react-captcha'
97
98const ExampleComponent = React.createClass({
99 getInitialState () {
100 return {
101 captchaSrc: './captcha.svg'
102 }
103 },
104 render () {
105 const s = this
106 let { state } = s
107 return (
108 <div>
109 <ApCaptchaStyle />
110 <ApCaptcha src={ state.captchaSrc }
111 refreshText="refresh"
112 onRefresh={ s.refreshCaptcha }/>
113 </div>
114 )
115 },
116 refreshCaptcha () {
117 const s = this
118 let time = new Date().getTime()
119 console.log('refreshCaptcha:', time)
120 s.setState({
121 captchaSrc: `./images/mock-captcha.svg?t=${time}`
122 })
123 }
124})
125
126```
127
128
129
130<!-- Section from "doc/guides/03.Usage.md.hbs" End -->
131
132<!-- Section from "doc/guides/04.Components.md.hbs" Start -->
133
134<a name="section-doc-guides-04-components-md"></a>
135
136Components
137-----
138
139
140### ApCaptchaStyle
141
142**Props**
143
144| Name | Type | Default | Description |
145| ---- | ---- | ------- | ----------- |
146| style | object | {} | | |
147
148### ApCaptchaSvg
149
150**Props**
151
152| Name | Type | Default | Description |
153| ---- | ---- | ------- | ----------- |
154| version | | &#x27;1.1&#x27; | | |
155| xmlns | | &#x27;http://www.w3.org/2000/svg&#x27; | | |
156| text | | &#x27;&#x27; | | |
157| width | | 256 | | |
158| height | | 92 | | |
159
160### ApCaptcha
161
162**Props**
163
164| Name | Type | Default | Description |
165| ---- | ---- | ------- | ----------- |
166| src | string | null | | Image source url |
167| onRefresh | func | null | | Handler for refresh |
168| refreshIcon | string | &#x27;fa fa-refresh&#x27; | | |
169| refreshText | string | &#x27;&#x27; | | |
170| imageWidth | number | 240 | | |
171| imageHeight | number | 94 | | |
172| onImageLoad | func | null | | |
173| onImageError | func | null | | |
174| spinning | bool | false | | |
175| spinnerTheme | string | ApSpinner.DEFAULT_THEME | | |
176
177
178<!-- Section from "doc/guides/04.Components.md.hbs" End -->
179
180
181<!-- Sections Start -->
182
183
184<!-- LICENSE Start -->
185<a name="license"></a>
186
187License
188-------
189This software is released under the [MIT License](https://github.com/apeman-react-labo/apeman-react-captcha/blob/master/LICENSE).
190
191<!-- LICENSE End -->
192
193
194<!-- Links Start -->
195<a name="links"></a>
196
197Links
198------
199
200+ [apeman][apeman_url]
201+ [apeman-react-labo][apeman_react_labo_url]
202+ [React][react_url]
203
204[apeman_url]: https://github.com/apeman-labo/apeman
205[apeman_react_labo_url]: https://github.com/apeman-react-labo
206[react_url]: https://facebook.github.io/react/
207
208<!-- Links End -->