This repository has been archived by the owner on Apr 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
App.js
63 lines (52 loc) · 1.56 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import React from 'react';
import ReactPasswordStrength from 'react-password-strength';
export default class App extends React.Component {
state = { passLength: 0 }
changeCallback = state =>
this.setState({ passLength: state.password.length })
clear = () => this.ReactPasswordStrength.clear()
render() {
const inputProps = {
placeholder: "Try a password...",
autoFocus: true,
className: 'another-input-prop-class-name',
};
return (
<div id="example">
<h1>React Password Strength Tool</h1>
<p>
Powered by
{' '}
<a
href="https://github.com/dropbox/zxcvbn"
target="_blank"
rel="noopener noreferrer"
>
zxcvbn
</a>
</p>
<ReactPasswordStrength
ref={ref => this.ReactPasswordStrength = ref}
minLength={6}
inputProps={{ ...inputProps, id: 'inputPassword1' }}
changeCallback={this.changeCallback}
/>
<button onClick={this.clear} disabled={this.state.passLength === 0}>
Clear
</button>
<h3>Password Input with Default Value</h3>
<ReactPasswordStrength
minLength={6}
inputProps={{ ...inputProps, id: 'inputPassword2' }}
defaultValue="defaultValue"
/>
<h3>Password Input with Custom Styling</h3>
<ReactPasswordStrength
className="CustomInput"
minLength={6}
inputProps={{ ...inputProps, id: 'inputPassword3' }}
/>
</div>
);
}
}