Skip to content

Commit

Permalink
Fix links in docs (#927)
Browse files Browse the repository at this point in the history
* Update versioned docs

* Add `replace` to v1.2.0 docs

* Move typo fix to v1.2.0 docs

* Add `<ErrorMessage />` example to v1.3.0 docs

* Adjust links for new website

* Fix links to versioned docs
  • Loading branch information
ansgarprause authored and jaredpalmer committed Sep 22, 2018
1 parent e0d8e3f commit 723ee85
Show file tree
Hide file tree
Showing 12 changed files with 272 additions and 76 deletions.
4 changes: 2 additions & 2 deletions docs/api/fieldarray.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const FriendList = () => (

### `name: string`

The name or path to the relevant key in [`values`].
The name or path to the relevant key in [`values`](api/formik.md#values-field-string-any).

### `validateOnChange?: boolean`

Expand Down Expand Up @@ -109,7 +109,7 @@ You can also iterate through an array of objects, by following a convention of `

Validation can be tricky with `<FieldArray>`.

If you use [`validationSchema`] and your form has array validation requirements (like a min length) as well as nested array field requirements, displaying errors can be tricky. Formik/Yup will show validation errors inside out. For example,
If you use [`validationSchema`](api/formik.md#validationschema-schema-schema) and your form has array validation requirements (like a min length) as well as nested array field requirements, displaying errors can be tricky. Formik/Yup will show validation errors inside out. For example,

```js
const schema = Yup.object().shape({
Expand Down
12 changes: 6 additions & 6 deletions docs/api/formik.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ to `<button onClick={handleReset}>...</button>`

#### `handleSubmit: (e: React.FormEvent<HTMLFormEvent>) => void`

Submit handler. This should be passed to `<form onSubmit={props.handleSubmit}>...</form>`. To learn more about the submission process, see [How Form Submission Works](#how-form-submission-works).
Submit handler. This should be passed to `<form onSubmit={props.handleSubmit}>...</form>`. To learn more about the submission process, see [Form Submission](guides/form-submission.md).

#### `isSubmitting: boolean`

Submitting state of the form. Returns `true` if submission is in progress and `false` otherwise. IMPORTANT: Formik will set this to `true` as soon as submission is _attempted_. To learn more about the submission process, see [How Form Submission Works](#how-form-submission-works).
Submitting state of the form. Returns `true` if submission is in progress and `false` otherwise. IMPORTANT: Formik will set this to `true` as soon as submission is _attempted_. To learn more about the submission process, see [Form Submission](guides/form-submission.md).

#### `isValid: boolean`

Expand All @@ -111,7 +111,7 @@ Returns `true` if the there are no `errors`, or the result of

#### `isValidating: boolean`

Returns `true` if Formik is running any validation function, `false` otherwise. To learn more about what happens with `isValidating` during the submission process, see [How Form Submission Works](#how-form-submission-works).
Returns `true` if Formik is running any validation function, `false` otherwise. To learn more about what happens with `isValidating` during the submission process, see [Form Submission](guides/form-submission.md).

#### `resetForm: (nextValues?: Values) => void`

Expand Down Expand Up @@ -140,8 +140,8 @@ Trigger a form submission.

#### `submitCount: number`

Number of times user tried to submit the form. Increases when `handleSubmit`(#handlesubmit-values-values-formikbag-formikbag--void) is called, resets after calling
`handleReset`(#handlereset---void). `submitCount` is readonly computed property and should not be mutated directly.
Number of times user tried to submit the form. Increases when [`handleSubmit`](#handlesubmit-e-reactformevent-htmlformevent-void) is called, resets after calling
[`handleReset`](#handlereset-void). `submitCount` is readonly computed property and should not be mutated directly.

#### `setFieldValue: (field: string, value: any, shouldValidate?: boolean) => void`

Expand Down Expand Up @@ -173,7 +173,7 @@ otherwise be expressed/stored with other methods. This is useful for capturing
and passing through API responses to your inner component.

`status` should only be modifed by calling
`setStatus: (status?: any) => void`(#setstatus-status-any--void)
[`setStatus`](#setstatus-status-any-void).

#### `touched: { [field: string]: boolean }`

Expand Down
2 changes: 1 addition & 1 deletion docs/api/withFormik.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,4 @@ component's `errors`. Its keys should match those of `values`.

## Injected props and methods

These are identical to the props of [`<Formik render={props => ...} />`](formik#formik-render-methods-and-props)
These are identical to the props of [`<Formik render={props => ...} />`](api/formik.md#formik-render-methods-and-props)
8 changes: 5 additions & 3 deletions docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,11 @@ API that's pretty similar [Joi](https://github.com/hapijs/joi) /
[React PropTypes](https://github.com/facebook/prop-types) but is small enough
for the browser and fast enough for runtime usage. Because I :heart: Yup sooo
much, Formik has a special config option / prop for Yup called
[`validationSchema`] which will automatically transform Yup's validation errors
into a pretty object whose keys match [`values`] and [`touched`]. Anyways, you
can install Yup from npm...
[`validationSchema`](api/formik.md#validationschema-schema-schema) which will
automatically transform Yup's validation errors into a pretty object whose keys
match [`values`](api/formik.md#values-field-string-any) and
[`touched`](api/formik.md#touched-field-string-boolean). Anyways, you can
install Yup from npm...

```
npm install yup --save
Expand Down
10 changes: 8 additions & 2 deletions website/pages/en/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ function Versions() {
<tr>
<th>{latestVersion}</th>
<td>
<a href="/docs/overview">Documentation</a>
<a href={`${siteConfig.baseUrl}docs/overview`}>
Documentation
</a>
</td>
<td>
<a href={repoUrl + '/releases'}>Release Notes</a>
Expand Down Expand Up @@ -72,7 +74,11 @@ function Versions() {
<tr>
<th>{version}</th>
<td>
<a href="">Documentation</a>
<a
href={`${siteConfig.baseUrl}docs/${version}/overview`}
>
Documentation
</a>
</td>
<td>
<a href={repoUrl + '/releases/tag/v' + version}>
Expand Down
5 changes: 3 additions & 2 deletions website/versioned_docs/version-1.2.0/api/fieldarray.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const FriendList = () => (

### `name: string`

The name or path to the relevant key in [`values`].
The name or path to the relevant key in [`values`](api/formik.md#values-field-string-any).

### `validateOnChange?: boolean`

Expand Down Expand Up @@ -110,7 +110,7 @@ You can also iterate through an array of objects, by following a convention of `

Validation can be tricky with `<FieldArray>`.

If you use [`validationSchema`] and your form has array validation requirements (like a min length) as well as nested array field requirements, displaying errors can be tricky. Formik/Yup will show validation errors inside out. For example,
If you use [`validationSchema`](api/formik.md#validationschema-schema-schema) and your form has array validation requirements (like a min length) as well as nested array field requirements, displaying errors can be tricky. Formik/Yup will show validation errors inside out. For example,

```js
const schema = Yup.object().shape({
Expand Down Expand Up @@ -183,6 +183,7 @@ The following methods are made available via render props.
* `unshift: (value: any) => number`: Add an element to the beginning of an array and return its length
* `remove<T>(index: number): T | undefined`: Remove an element at an index of an array and return it
* `pop<T>(): T | undefined`: Remove and return value from the end of the array
* `replace: (index: number, value: any) => void`: Replace a value at the given index into the array

## FieldArray render methods

Expand Down
12 changes: 6 additions & 6 deletions website/versioned_docs/version-1.2.0/api/formik.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ to `<button onClick={handleReset}>...</button>`

#### `handleSubmit: (e: React.FormEvent<HTMLFormEvent>) => void`

Submit handler. This should be passed to `<form onSubmit={props.handleSubmit}>...</form>`. To learn more about the submission process, see [How Form Submission Works](#how-form-submission-works).
Submit handler. This should be passed to `<form onSubmit={props.handleSubmit}>...</form>`. To learn more about the submission process, see [Form Submission](guides/form-submission.md).

#### `isSubmitting: boolean`

Submitting state of the form. Returns `true` if submission is in progress and `false` otherwise. IMPORTANT: Formik will set this to `true` as soon as submission is _attempted_. To learn more about the submission process, see [How Form Submission Works](#how-form-submission-works).
Submitting state of the form. Returns `true` if submission is in progress and `false` otherwise. IMPORTANT: Formik will set this to `true` as soon as submission is _attempted_. To learn more about the submission process, see [Form Submission](guides/form-submission.md).

#### `isValid: boolean`

Expand All @@ -112,7 +112,7 @@ Returns `true` if the there are no `errors`, or the result of

#### `isValidating: boolean`

Returns `true` if Formik is running any validation function, `false` otherwise. To learn more about what happens with `isValidating` during the submission process, see [How Form Submission Works](#how-form-submission-works).
Returns `true` if Formik is running any validation function, `false` otherwise. To learn more about what happens with `isValidating` during the submission process, see [Form Submission](guides/form-submission.md).

#### `resetForm: (nextValues?: Values) => void`

Expand Down Expand Up @@ -141,8 +141,8 @@ Trigger a form submission.

#### `submitCount: number`

Number of times user tried to submit the form. Increases when `handleSubmit`(#handlesubmit-values-values-formikbag-formikbag--void) is called, resets after calling
`handleReset`(#handlereset---void). `submitCount` is readonly computed property and should not be mutated directly.
Number of times user tried to submit the form. Increases when [`handleSubmit`](#handlesubmit-e-reactformevent-htmlformevent-void) is called, resets after calling
[`handleReset`](#handlereset-void). `submitCount` is readonly computed property and should not be mutated directly.

#### `setFieldValue: (field: string, value: any, shouldValidate?: boolean) => void`

Expand Down Expand Up @@ -174,7 +174,7 @@ otherwise be expressed/stored with other methods. This is useful for capturing
and passing through API responses to your inner component.

`status` should only be modifed by calling
`setStatus: (status?: any) => void`(#setstatus-status-any--void)
[`setStatus`](#setstatus-status-any-void).

#### `touched: { [field: string]: boolean }`

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-1.2.0/api/withFormik.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@ component's `errors`. Its keys should match those of `values`.

## Injected props and methods

These are identical to the props of [`<Formik render={props => ...} />`](formik#formik-render-methods-and-props)
These are identical to the props of [`<Formik render={props => ...} />`](api/formik.md#formik-render-methods-and-props)
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ DOM and React Native are:
1. Formik's `props.handleSubmit` is passed to a `<Button onPress={...} />`
instead of HTML `<form onSubmit={...} />` component (since there is no
`<form />` element in React Native).
2. `<TextInput />` uses Formik's `props.handleChange(fieldName)` and `handleBlur(fieldName)` instead of directly assigning the callbacks to props, because we have to get the `fieldName` from somewhere and with ReactNative we can't get it automatically like for web (using input name attribute). You can also use `props.setFieldValue(fieldName, value)` and `props.setTouched(fieldName, bool)` as an alternative.
2. `<TextInput />` uses Formik's `props.handleChange(fieldName)` and `handleBlur(fieldName)` instead of directly assigning the callbacks to props, because we have to get the `fieldName` from somewhere and with ReactNative we can't get it automatically like for web (using input name attribute). You can also use `setFieldValue(fieldName, value)` and `setTouched(fieldName, bool)` as an alternative.
10 changes: 6 additions & 4 deletions website/versioned_docs/version-1.2.0/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ import { Formik } from 'formik';

const Basic = () => (
<div>
<h1>Anywher in your app!</h1>
<h1>Anywhere in your app!</h1>
<Formik
initialValues={{ email: '', password: '' }}
validate={values => {
Expand Down Expand Up @@ -222,9 +222,11 @@ API that's pretty similar [Joi](https://github.com/hapijs/joi) /
[React PropTypes](https://github.com/facebook/prop-types) but is small enough
for the browser and fast enough for runtime usage. Because I :heart: Yup sooo
much, Formik has a special config option / prop for Yup called
[`validationSchema`] which will automatically transform Yup's validation errors
into a pretty object whose keys match [`values`] and [`touched`]. Anyways, you
can install Yup from npm...
[`validationSchema`](api/formik.md#validationschema-schema-schema) which will
automatically transform Yup's validation errors into a pretty object whose keys
match [`values`](api/formik.md#values-field-string-any) and
[`touched`](api/formik.md#touched-field-string-boolean). Anyways, you can
install Yup from npm...

```
npm install yup --save
Expand Down
48 changes: 0 additions & 48 deletions website/versioned_docs/version-1.3.0/guides/react-native.md

This file was deleted.

Loading

0 comments on commit 723ee85

Please sign in to comment.