Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] Fix typos #5845

Merged
merged 3 commits into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/CreateEdit.md
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,7 @@ const VisitorForm = ({ basePath, record, save, saving, version }) => {
key={version} // support for refresh button
keepDirtyOnReinitialize
render={formProps => (
// render your custom form here
{/* render your custom form here */}
)}
/>
);
Expand Down
20 changes: 10 additions & 10 deletions docs/Fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ To override the style of all instances of `<ReferenceArrayField>` using the [mat
export const App = () => (
<Admin dataProvider={restProvider('http://path.to.my.api')}>
<Resource name="posts" list={PostList} />
<Resource name="tags" /> // <= this one is compulsory
<Resource name="tags" /> {/* <= this one is compulsory */}
</Admin>
);
```
Expand Down Expand Up @@ -1129,17 +1129,17 @@ This is how to use it:

```jsx
<TranslatableFields locales={['en', 'fr']}>
<TextField source="name">
<TextField source="description">
<TextField source="name" />
<TextField source="description" />
</TranslatableFields>
```

React-admin uses the user locale as the default locale in this field. You can override this setting using the `defaultLocale` prop.

```jsx
<TranslatableFields locales={['en', 'fr']} defaultLocale="fr">
<TextField source="name">
<TextField source="description">
<TextField source="name" />
<TextField source="description" />
</TranslatableFields>
```

Expand All @@ -1157,7 +1157,7 @@ const Selector = () => {
selectedLocale,
} = useTranslatableContext();

const handleChange = (event): void => {
const handleChange = event => {
selectLocale(event.target.value);
};

Expand Down Expand Up @@ -1197,8 +1197,8 @@ If you have multiple `TranslatableFields` on the same page, you should specify a

```jsx
<TranslatableFields locales={['en', 'fr']} groupKey="essential-fields">
<TextField source="name">
<TextField source="description">
<TextField source="name" />
<TextField source="description" />
</TranslatableFields>
```

Expand All @@ -1210,13 +1210,13 @@ In this case, you'll have to get the current locale through the `useLocale` hook

{% raw %}
```jsx
const PostList = (props) => {
const PostList = props => {
const locale = useLocale();

return (
<List {...props}>
<Datagrid>
<TextField source={`name.${locale}`}>
<TextField source={`name.${locale}`} />
<ReferenceArrayField
label="Tags"
reference="tags"
Expand Down
18 changes: 9 additions & 9 deletions docs/Inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1696,17 +1696,17 @@ This is how to use it:

```jsx
<TranslatableInputs locales={['en', 'fr']}>
<TextInput source="name">
<RichTextInput source="description">
<TextInput source="name" />
<RichTextInput source="description" />
</TranslatableInputs>
```

React-admin uses the user locale as the default locale in this field. You can override this setting using the `defaultLocale` prop.

```jsx
<TranslatableInputs locales={['en', 'fr']} defaultLocale="fr">
<TextInput source="name">
<RichTextInput source="description">
<TextInput source="name" />
<RichTextInput source="description" />
</TranslatableInputs>
```

Expand All @@ -1724,7 +1724,7 @@ const Selector = () => {
selectedLocale,
} = useTranslatableContext();

const handleChange = (event): void => {
const handleChange = event => {
selectLocale(event.target.value);
};

Expand Down Expand Up @@ -1764,17 +1764,17 @@ If you have multiple `TranslatableInputs` on the same page, you should specify a

```jsx
<TranslatableInputs locales={['en', 'fr']} groupKey="essential-fields">
<TextInput source="name">
<RichTextInput source="description">
<TextInput source="name" />
<RichTextInput source="description" />
</TranslatableInputs>
```

You can add validators to any of the inputs inside a `TranslatableInputs`. If an input has some validation error, the label of its parent tab will be highlighted as invalid:

```jsx
<TranslatableInputs locales={['en', 'fr']}>
<TextInput source="name" validate={[required()]}>
<RichTextInput source="description" validate={[maxLength(100)]}>
<TextInput source="name" validate={[required()]} />
<RichTextInput source="description" validate={[maxLength(100)]} />
</TranslatableInputs>
```

Expand Down
14 changes: 7 additions & 7 deletions docs/List.md
Original file line number Diff line number Diff line change
Expand Up @@ -756,13 +756,13 @@ const TagsEdit = (props) => (
<Edit {...props}>
// ...
</Edit>
<ResourceProviderContext resource="posts">
<ResourceContextProvider resource="posts">
<List syncWithLocation basePath="/posts" filter={{ tags: [id]}}>
<Datagri>
<Datagrid>
<TextField source="title" />
</Datagrid>
</List>
</ResourceProviderContext>
</ResourceContextProvider>
</>
)
```
Expand Down Expand Up @@ -1812,9 +1812,9 @@ export const PaginationActions = props => <RaPaginationActions {...props} color=
export const Pagination = props => <RaPagination {...props} ActionsComponent={PaginationActions} />;

export const UserList = props => (
<List {...props} pagination={<Pagination />} />
...
</List
<List {...props} pagination={<Pagination />} >
//...
</List>
);
```

Expand Down Expand Up @@ -2367,7 +2367,7 @@ import keyBy from 'lodash/keyBy'
import {
useQuery,
ResourceContextProvider,
ListContextProvider
ListContextProvider,
Datagrid,
TextField,
Pagination,
Expand Down
2 changes: 1 addition & 1 deletion docs/Translation.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const App = () => (
authProvider={authProvider}
i18nProvider={i18nProvider}
>
<Resource name="posts" list={...}>
<Resource name="posts" list={/* ... */}>
// ...
```

Expand Down
2 changes: 1 addition & 1 deletion docs/Tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ import {
} from 'react-admin';

export const PostList = props => (
// ...
{ /* ... */ }
);

export const PostEdit = props => (
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/auth/usePermissionsOptimized.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('usePermissionsOptimized', () => {
expect(getPermissions).toBeCalledTimes(1);
expect(queryByText('admin')).toBeNull();
await act(async () => await new Promise(r => setTimeout(r)));
expect(renders).toBe(2); // rerenders when the getPermissions returns
expect(renders).toBe(2); // re-renders when the getPermissions returns
expect(queryByText('admin')).not.toBeNull();

// second usage
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/controller/useListController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface ListProps {
location?: Location;
path?: string;
resource?: string;
// Wether to synchronize the list parameters with the current location (URL search parameters)
// Whether to synchronize the list parameters with the current location (URL search parameters)
// This is set to true automatically when a List is used inside a Resource component
syncWithLocation?: boolean;
[key: string]: any;
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/controller/useListParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface ListParamsOptions {
// default value for a filter when displayed but not yet set
filterDefaultValues?: FilterPayload;
debounce?: number;
// Wether to synchronize the list parameters with the current location (URL search parameters)
// Whether to synchronize the list parameters with the current location (URL search parameters)
// This is set to true automatically when a List is used inside a Resource component
syncWithLocation?: boolean;
}
Expand Down