This repository was archived by the owner on Apr 10, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +104
-0
lines changed Expand file tree Collapse file tree 2 files changed +104
-0
lines changed Original file line number Diff line number Diff line change 1+ <!doctype html>
2+
3+ < html >
4+ < head >
5+ < title > React Password Strength Example</ title >
6+
7+ < style media ="screen ">
8+ body {
9+ background : # e6e6e6 ;
10+ font-family : "Helvetica Neue" , Helvetica, Arial, sans-serif;
11+ }
12+
13+ # example {
14+ background : # fff ;
15+ margin : 50px auto 30px ;
16+ min-height : 250px ;
17+ padding : 45px 75px ;
18+ width : 500px ;
19+ }
20+
21+ label {
22+ display : inline-block;
23+ margin-bottom : 10px ;
24+ }
25+
26+ button {
27+ background : # fff ;
28+ border : none;
29+ color : # 6e6e6e ;
30+ font-size : 16px ;
31+ padding : 5px 8px ;
32+ margin-top : 10px ;
33+ opacity : 1 ;
34+ transition : opacity 250ms ease-in-out;
35+ }
36+
37+ button : hover ,
38+ button : focus {
39+ cursor : pointer;
40+ outline : none;
41+ }
42+
43+ button : disabled {
44+ opacity : 0 ;
45+ }
46+ </ style >
47+ </ head >
48+
49+ < body >
50+ < div id ="example "> </ div >
51+ < script src ="bundle.js "> </ script >
52+ </ body >
53+ </ html >
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import ReactDOM from 'react-dom' ;
3+ import ReactPasswordStrength from "../dist/index" ;
4+
5+ class App extends React . Component {
6+ state = {
7+ passLength : 0 ,
8+ }
9+
10+ changeCallback = state =>
11+ this . setState ( { passLength : state . password . length } )
12+
13+ clear = ( ) => this . ReactPasswordStrength . clear ( )
14+
15+ render ( ) {
16+ const inputProps = {
17+ placeholder : "Try a password..." ,
18+ id : "inputPassword" ,
19+ autoFocus : true ,
20+ className : 'another-input-prop-class-name' ,
21+ } ;
22+
23+ return (
24+ < div >
25+ < h1 > React Password Strength Tool</ h1 >
26+ < p > Powered by < a href = "https://github.com/dropbox/zxcvbn" target = "_blank" > zxcvbn</ a > </ p >
27+
28+ < ReactPasswordStrength
29+ ref = { ref => this . ReactPasswordStrength = ref }
30+ minLength = { 6 }
31+ inputProps = { inputProps }
32+ changeCallback = { this . changeCallback }
33+ />
34+
35+ < button onClick = { this . clear } disabled = { this . state . passLength === 0 } >
36+ Clear
37+ </ button >
38+
39+ < h3 > Password Input with Default Value for password</ h3 >
40+
41+ < ReactPasswordStrength
42+ minLength = { 6 }
43+ inputProps = { inputProps }
44+ defaultValue = "defaultValue"
45+ />
46+ </ div >
47+ ) ;
48+ }
49+ }
50+
51+ ReactDOM . render ( < App /> , document . getElementById ( "example" ) ) ;
You can’t perform that action at this time.
0 commit comments