mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* webpack poc, this is not going to work for plugins, dam * tech: webpack and systemjs for plugins starting to work * tech: webpack and systemjs combo starting to work * tech: webpack + karma tests progress * tech: webpack + karma progress * tech: working on tests * tech: webpack * tech: webpack + karma, all tests pass * tech: webpack + karma, all tests pass * tech: webpack all tests pass * webpack: getting closer * tech: webpack progress * webpack: further build refinements * webpack: ng annotate fixes * webpack: optimized build fix * tech: minor fix for elasticsearch * tech: webpack + ace editor * tech: restored lodash move mixin compatability * tech: added enzyme react test and upgraded to react v16 * tech: package version fix * tech: added testdata to built in bundle * webpack: sass progress * tech: prod & dev build is working for the sass * tech: clean up unused grunt stuff and moved to scripts folder * tech: added vendor and manifest chunks, updated readme and docs * tech: webpack finishing touches
40 lines
914 B
TypeScript
40 lines
914 B
TypeScript
import React from 'react';
|
|
import coreModule from '../core_module';
|
|
|
|
export interface IProps {
|
|
password: string;
|
|
}
|
|
|
|
export class PasswordStrength extends React.Component<IProps, any> {
|
|
|
|
constructor(props) {
|
|
super(props);
|
|
}
|
|
|
|
render() {
|
|
let strengthText = "strength: strong like a bull.";
|
|
let strengthClass = "password-strength-good";
|
|
|
|
if (this.props.password.length <= 8) {
|
|
strengthText = "strength: you can do better.";
|
|
strengthClass = "password-strength-ok";
|
|
}
|
|
|
|
if (this.props.password.length < 4) {
|
|
strengthText = "strength: weak sauce.";
|
|
strengthClass = "password-strength-bad";
|
|
}
|
|
|
|
return (
|
|
<div className={`password-strength small ${strengthClass}`}>
|
|
<em>{strengthText}</em>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
coreModule.directive('passwordStrength', function(reactDirective) {
|
|
return reactDirective(PasswordStrength, ['password']);
|
|
});
|
|
|