Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #194 from tabler/account-pages
Browse files Browse the repository at this point in the history
LoginPage
  • Loading branch information
jonthomp committed May 28, 2018
2 parents 9990c47 + 6fac4d8 commit 188c5b1
Show file tree
Hide file tree
Showing 24 changed files with 574 additions and 141 deletions.
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"license": "MIT",
"dependencies": {
"d3-scale": "^2.0.0",
"formik": "^0.11.11",
"prop-types": "^15.6.1",
"react": "^16.2.0",
"react-c3js": "^0.1.20",
Expand Down
19 changes: 2 additions & 17 deletions example/src/pages/ForgotPasswordPage.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,12 @@

import * as React from "react";

import { FormCard, FormTextInput, StandaloneFormPage } from "tabler-react";
import { ForgotPasswordPage as TablerForgotPasswordPage } from "tabler-react";

type Props = {||};

function ForgotPasswordPage(props: Props): React.Node {
return (
<StandaloneFormPage>
<FormCard
action=""
buttonText="Request Password Change"
method="get"
title="Forgot Password"
>
<p className="text-muted">
Enter your email address and your password will be reset and emailed
to you.
</p>
<FormTextInput label="Email Address" placeHolder="Enter email" />
</FormCard>
</StandaloneFormPage>
);
return <TablerForgotPasswordPage />;
}

export default ForgotPasswordPage;
59 changes: 43 additions & 16 deletions example/src/pages/LoginPage.react.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,55 @@
// @flow

import * as React from "react";

import { FormCard, FormTextInput, StandaloneFormPage } from "tabler-react";
import { Formik } from "formik";
import { LoginPage as TablerLoginPage } from "tabler-react";

type Props = {||};

function LoginPage(props: Props): React.Node {
return (
<StandaloneFormPage>
<FormCard
action=""
buttonText="Login"
method="get"
title="Login to your Account"
>
<FormTextInput label="Email Address" placeHolder="Enter email" />
<FormTextInput
type="password"
label="Password"
placeHolder="Password"
<Formik
initialValues={{
email: "",
password: "",
}}
validate={values => {
// same as above, but feel free to move this into a class method now.
let errors = {};
if (!values.email) {
errors.email = "Required";
} else if (
!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(values.email)
) {
errors.email = "Invalid email address";
}
return errors;
}}
onSubmit={(
values,
{ setSubmitting, setErrors /* setValues and other goodies */ }
) => {
alert("Done!");
}}
render={({
values,
errors,
touched,
handleChange,
handleBlur,
handleSubmit,
isSubmitting,
}) => (
<TablerLoginPage
onSubmit={handleSubmit}
onChange={handleChange}
onBlur={handleBlur}
values={values}
errors={errors}
touched={touched}
/>
</FormCard>
</StandaloneFormPage>
)}
/>
);
}

Expand Down
27 changes: 2 additions & 25 deletions example/src/pages/RegisterPage.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,12 @@

import * as React from "react";

import {
FormCard,
FormTextInput,
FormCheckboxInput,
StandaloneFormPage,
} from "tabler-react";
import { RegisterPage as TablerRegisterPage } from "tabler-react";

type Props = {||};

function RegisterPage(props: Props): React.Node {
return (
<StandaloneFormPage>
<FormCard
action=""
buttonText="Create Account"
method="get"
title="Create New Account"
>
<FormTextInput label="Name" placeHolder="Enter name" />
<FormTextInput label="Email Address" placeHolder="Enter email" />
<FormTextInput
type="password"
label="Password"
placeHolder="Password"
/>
<FormCheckboxInput label="Agree to the terms and policy" />
</FormCard>
</StandaloneFormPage>
);
return <TablerRegisterPage />;
}

export default RegisterPage;
108 changes: 106 additions & 2 deletions example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,33 @@
mkdirp "^0.5.1"
rimraf "^2.5.2"

"@semantic-release/changelog@^2.0.2":
version "2.0.2"
resolved "https://registry.yarnpkg.com/@semantic-release/changelog/-/changelog-2.0.2.tgz#9972738dc97cf8b516f4200b8ee92e708e415d65"
dependencies:
"@semantic-release/error" "^2.1.0"
aggregate-error "^1.0.0"
fs-extra "^6.0.0"
lodash "^4.17.4"

"@semantic-release/error@^2.1.0":
version "2.2.0"
resolved "https://registry.yarnpkg.com/@semantic-release/error/-/error-2.2.0.tgz#ee9d5a09c9969eade1ec864776aeda5c5cddbbf0"

"@semantic-release/git@^5.0.0":
version "5.0.0"
resolved "https://registry.yarnpkg.com/@semantic-release/git/-/git-5.0.0.tgz#13703fca8f8c8c03066b0d005ee6a8c0119c3164"
dependencies:
"@semantic-release/error" "^2.1.0"
aggregate-error "^1.0.0"
debug "^3.1.0"
dir-glob "^2.0.0"
execa "^0.10.0"
fs-extra "^6.0.0"
lodash "^4.17.4"
micromatch "^3.1.4"
p-reduce "^1.0.0"

"@vxna/mini-html-webpack-template@^0.1.7":
version "0.1.7"
resolved "https://registry.yarnpkg.com/@vxna/mini-html-webpack-template/-/mini-html-webpack-template-0.1.7.tgz#2a8270e513ee14f395cc17c2ce22ced383c45d22"
Expand Down Expand Up @@ -202,6 +229,13 @@ address@1.0.3, address@^1.0.1:
version "1.0.3"
resolved "https://registry.yarnpkg.com/address/-/address-1.0.3.tgz#b5f50631f8d6cec8bd20c963963afb55e06cbce9"

aggregate-error@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-1.0.0.tgz#888344dad0220a72e3af50906117f48771925fac"
dependencies:
clean-stack "^1.0.0"
indent-string "^3.0.0"

ajv-keywords@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762"
Expand Down Expand Up @@ -1711,6 +1745,10 @@ clean-css@4.1.x:
dependencies:
source-map "0.5.x"

clean-stack@^1.0.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-1.3.0.tgz#9e821501ae979986c46b1d66d2d432db2fd4ae31"

clean-webpack-plugin@^0.1.19:
version "0.1.19"
resolved "https://registry.yarnpkg.com/clean-webpack-plugin/-/clean-webpack-plugin-0.1.19.tgz#ceda8bb96b00fe168e9b080272960d20fdcadd6d"
Expand Down Expand Up @@ -2120,6 +2158,16 @@ cross-spawn@5.1.0, cross-spawn@^5.0.1, cross-spawn@^5.1.0:
shebang-command "^1.2.0"
which "^1.2.9"

cross-spawn@^6.0.0:
version "6.0.5"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
dependencies:
nice-try "^1.0.4"
path-key "^2.0.1"
semver "^5.5.0"
shebang-command "^1.2.0"
which "^1.2.9"

crypto-browserify@^3.11.0:
version "3.12.0"
resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec"
Expand Down Expand Up @@ -3042,6 +3090,18 @@ exec-sh@^0.2.0:
dependencies:
merge "^1.1.3"

execa@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-0.10.0.tgz#ff456a8f53f90f8eccc71a96d11bdfc7f082cb50"
dependencies:
cross-spawn "^6.0.0"
get-stream "^3.0.0"
is-stream "^1.1.0"
npm-run-path "^2.0.0"
p-finally "^1.0.0"
signal-exit "^3.0.0"
strip-eof "^1.0.0"

execa@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777"
Expand Down Expand Up @@ -3400,6 +3460,16 @@ format@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/format/-/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b"

formik@^0.11.11:
version "0.11.11"
resolved "https://registry.yarnpkg.com/formik/-/formik-0.11.11.tgz#4b02838133c0196b1ef443aa973766cd097ec4a5"
dependencies:
lodash.clonedeep "^4.5.0"
lodash.isequal "4.5.0"
lodash.topath "4.5.2"
prop-types "^15.5.10"
warning "^3.0.0"

forwarded@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84"
Expand Down Expand Up @@ -3439,6 +3509,14 @@ fs-extra@^0.30.0:
path-is-absolute "^1.0.0"
rimraf "^2.2.8"

fs-extra@^6.0.0:
version "6.0.1"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-6.0.1.tgz#8abc128f7946e310135ddc93b98bddb410e7a34b"
dependencies:
graceful-fs "^4.1.2"
jsonfile "^4.0.0"
universalify "^0.1.0"

fs-minipass@^1.2.5:
version "1.2.5"
resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.5.tgz#06c277218454ec288df77ada54a03b8702aacb9d"
Expand Down Expand Up @@ -4836,6 +4914,12 @@ jsonfile@^3.0.0:
optionalDependencies:
graceful-fs "^4.1.6"

jsonfile@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
optionalDependencies:
graceful-fs "^4.1.6"

jsonify@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73"
Expand Down Expand Up @@ -5035,6 +5119,10 @@ lodash.camelcase@4.3.0, lodash.camelcase@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"

lodash.clonedeep@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"

lodash.cond@^4.3.0:
version "4.5.2"
resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5"
Expand All @@ -5043,6 +5131,10 @@ lodash.defaults@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c"

lodash.isequal@4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0"

lodash.kebabcase@4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36"
Expand Down Expand Up @@ -5092,6 +5184,10 @@ lodash.topairs@4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/lodash.topairs/-/lodash.topairs-4.3.0.tgz#3b6deaa37d60fb116713c46c5f17ea190ec48d64"

lodash.topath@4.5.2:
version "4.5.2"
resolved "https://registry.yarnpkg.com/lodash.topath/-/lodash.topath-4.5.2.tgz#3616351f3bba61994a0931989660bd03254fd009"

lodash.uniq@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
Expand Down Expand Up @@ -5536,6 +5632,10 @@ next-tick@1:
version "1.0.0"
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c"

nice-try@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4"

no-case@^2.2.0:
version "2.3.2"
resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac"
Expand Down Expand Up @@ -5863,6 +5963,10 @@ p-map@^1.1.1:
version "1.2.0"
resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b"

p-reduce@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/p-reduce/-/p-reduce-1.0.0.tgz#18c2b0dd936a4690a529f8231f58a0fdb6a47dfa"

p-try@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3"
Expand Down Expand Up @@ -5979,7 +6083,7 @@ path-is-inside@^1.0.1, path-is-inside@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53"

path-key@^2.0.0:
path-key@^2.0.0, path-key@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"

Expand Down Expand Up @@ -7408,7 +7512,7 @@ semver-diff@^2.0.0:
dependencies:
semver "^5.0.3"

"semver@2 || 3 || 4 || 5", semver@5.5.0, semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1:
"semver@2 || 3 || 4 || 5", semver@5.5.0, semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"

Expand Down
3 changes: 2 additions & 1 deletion src/components/Form/FormCheckbox.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as React from "react";
import cn from "classnames";
import Form from "./";

type Props = {|
export type Props = {|
+className?: string,
+label?: string,
+value?: string | number | boolean,
Expand All @@ -13,6 +13,7 @@ type Props = {|
+disabled?: boolean,
+readOnly?: boolean,
+onChange?: (event: SyntheticInputEvent<HTMLInputElement>) => void,
+onBlur?: (event: SyntheticInputEvent<HTMLInputElement>) => void,
+isInline?: boolean,
|};

Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/FormInput.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type FormStyle = {|
+checked?: boolean,
|};

type Props = {|
export type Props = {|
...FormStyle,
+onChange?: (event: SyntheticInputEvent<HTMLInputElement>) => void,
+onBlur?: (event: SyntheticInputEvent<HTMLInputElement>) => void,
Expand Down
Loading

0 comments on commit 188c5b1

Please sign in to comment.