archive
/
zxcvbn-app
Archived
1
Fork 0

add results components

This commit is contained in:
Jake Howard 2016-09-18 12:01:28 +01:00
parent b4b2942438
commit 1c9612b3a3
Signed by: jake
GPG Key ID: 57AFB45680EDD477
5 changed files with 73 additions and 4 deletions

View File

@ -0,0 +1,27 @@
import React, { Component }from 'react';
import {
Text,
View,
StyleSheet
} from 'react-native';
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center'
} as React.ViewStyle,
});
interface Props {
}
export default function BlankResults(props : Props) {
return (
<View style={styles.container}>
<Text>Something</Text>
</View>
);
}

View File

@ -3,7 +3,6 @@ import React, { Component }from 'react';
import { TextInput, View, StyleSheet } from 'react-native';
import { BRAND_PRIMARY } from '../settings/styles';
const styles = StyleSheet.create({
inputBorder: {
borderWidth: 1,

View File

@ -0,0 +1,32 @@
import React, { Component }from 'react';
import zxcvbn from 'zxcvbn';
import {
Text,
View,
StyleSheet
} from 'react-native';
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center'
} as React.ViewStyle,
});
interface Props {
value: string;
}
interface State {
}
export default function Result(props : Props) {
const resultData = zxcvbn(props.value);
return (
<View style={styles.container}>
<Text>{resultData.score}</Text>
</View>
);
}

View File

@ -4,3 +4,8 @@ declare module "react-native-vector-icons/FontAwesome" {
var noTypeInfoYet: any; // any var name here really
export = noTypeInfoYet;
}
declare module "zxcvbn" {
var noTypeInfoYet: any; // any var name here really
export = noTypeInfoYet;
}

View File

@ -5,11 +5,14 @@ import {
View
} from 'react-native';
import Input from '../components/Input';
import Results from '../components/Results';
import BlankResults from '../components/BlankResults';
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'stretch',
justifyContent: 'center',
backgroundColor: '#FFF',
} as React.ViewStyle,
@ -39,12 +42,15 @@ export default class App extends Component<any, State> {
}
render() {
const results = this.state.text ? (
<Results value={this.state.text} />
) : (
<BlankResults />
);
return (
<View style={styles.container}>
<Input onSubmit={this.handleSubmit} value={this.state.text} />
<Text style={styles.text}>
Welcome to React Native!
</Text>
{ results }
</View>
);
}