Skip to content

Commit c670ab1

Browse files
authored
Merge pull request #9083 from WiXSL/fix-docs-syntax
[Doc] Fix code examples syntax errors
2 parents dfe13e7 + 08634c3 commit c670ab1

38 files changed

Lines changed: 118 additions & 117 deletions

docs/AccordionForm.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -549,20 +549,20 @@ const authProvider = {
549549
const ProductEdit = () => (
550550
<Edit>
551551
<AccordionForm>
552-
<AccordionForm.Panel label="description" label="Description">
552+
<AccordionForm.Panel name="description" label="Description">
553553
<TextInput source="reference" />
554554
<TextInput source="width" />
555555
<TextInput source="height" />
556556
<TextInput source="description" />
557557
</AccordionForm.Panel>
558-
<AccordionForm.Panel label="images" label="Images">
558+
<AccordionForm.Panel name="images" label="Images">
559559
<TextInput source="image" />
560560
<TextInput source="thumbnail" />
561561
</AccordionForm.Panel>
562-
<AccordionForm.Panel label="stock" label="Stock">
562+
<AccordionForm.Panel name="stock" label="Stock">
563563
<TextInput source="stock" />
564564
</AccordionForm.Panel>
565-
// delete button not displayed
565+
{ /* delete button not displayed */ }
566566
</AccordionForm>
567567
</Edit>
568568
);

docs/AuthProviderWriting.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ const authProvider = {
2323

2424
**Tip**: If you're a TypeScript user, you can check that your `authProvider` is correct at compile-time using the `AuthProvider` type.
2525

26-
```jsx
26+
```tsx
2727
import { AuthProvider } from 'react-admin';
2828

2929
const authProvider: AuthProvider = {
3030
// ...
31+
};
3132
```
3233

3334
## Example
@@ -414,7 +415,7 @@ import { PreviousLocationStorageKey } from 'react-admin';
414415
import { Auth0Client } from './Auth0Client';
415416

416417
export const authProvider = {
417-
async login() => { /* Nothing to do here, this function will never be called */ },
418+
async login() { /* Nothing to do here, this function will never be called */ },
418419
async checkAuth() {
419420
const isAuthenticated = await client.isAuthenticated();
420421
if (isAuthenticated) {
@@ -434,7 +435,7 @@ export const authProvider = {
434435
// and was redirected back to the /auth-callback route on the app
435436
async handleCallback() {
436437
const query = window.location.search;
437-
if (!query.includes('code=') && ¡query.includes('state=')) {
438+
if (!query.includes('code=') && !query.includes('state=')) {
438439
throw new Error('Failed to handle login callback.');
439440
}
440441
// If we did receive the Auth0 parameters,
@@ -451,7 +452,7 @@ You can override this behavior by returning an object with a `redirectTo` proper
451452

452453
```jsx
453454
async handleCallback() {
454-
if (!query.includes('code=') && ¡query.includes('state=')) {
455+
if (!query.includes('code=') && !query.includes('state=')) {
455456
throw new Error('Failed to handle login callback.');
456457
}
457458
// If we did receive the Auth0 parameters,

docs/AuthRBAC.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ Alternative to react-admin's `<Datagrid>` that adds RBAC control to columns
454454
To see a column, the user must have the permission to read the resource column:
455455

456456
```jsx
457-
{ action: "read", resource: `${resource}.${source}` }.
457+
{ action: "read", resource: `${resource}.${source}` }
458458
```
459459

460460
Also, the `rowClick` prop is automatically set depending on the user props:
@@ -894,17 +894,17 @@ const authProvider = {
894894
const ProductEdit = () => (
895895
<Edit>
896896
<AccordionForm>
897-
<AccordionForm.Panel label="description" label="Description">
897+
<AccordionForm.Panel name="description" label="Description">
898898
<TextInput source="reference" />
899899
<TextInput source="width" />
900900
<TextInput source="height" />
901901
<TextInput source="description" />
902902
</AccordionForm.Panel>
903-
<AccordionForm.Panel label="images" label="Images">
903+
<AccordionForm.Panel name="images" label="Images">
904904
<TextInput source="image" />
905905
<TextInput source="thumbnail" />
906906
</AccordionForm.Panel>
907-
<AccordionForm.Panel label="stock" label="Stock">
907+
<AccordionForm.Panel name="stock" label="Stock">
908908
<TextInput source="stock" />
909909
</AccordionForm.Panel>
910910
// delete button not displayed

docs/Authentication.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ For instance, here's what a simple authProvider for Auth0 might look like:
189189
import { Auth0Client } from './Auth0Client';
190190

191191
export const authProvider = {
192-
async login() => { /* Nothing to do here, this function will never be called */ },
192+
async login() { /* Nothing to do here, this function will never be called */ },
193193
async checkAuth() {
194194
const isAuthenticated = await Auth0Client.isAuthenticated();
195195
if (isAuthenticated) {

docs/Count.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ When used in conjunction to the `filter` prop, the link will point to the list v
9999

100100
{% raw %}
101101
```jsx
102-
<Count link filter={{ is_published: true }} link />
102+
<Count link filter={{ is_published: true }} />
103103
```
104104
{% endraw %}
105105

@@ -178,4 +178,4 @@ export const PostList = () => (
178178
</Datagrid>
179179
</List>
180180
)
181-
```
181+
```

docs/CreateBase.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,24 @@ import * as React from "react";
1818
import { CreateBase, SimpleForm, TextInput, SelectInput } from "react-admin";
1919
import { Card } from "@mui/material";
2020

21-
export const BookCreate = () => {
21+
export const BookCreate = () => (
2222
<CreateBase>
23-
<div>
24-
<Title title="Book Creation" />
25-
<Card>
26-
<SimpleForm>
27-
<TextInput source="title" />
28-
<TextInput source="author" />
29-
<SelectInput source="availability" choices={[
30-
{ id: "in_stock", name: "In stock" },
31-
{ id: "out_of_stock", name: "Out of stock" },
32-
{ id: "out_of_print", name: "Out of print" },
33-
]} />
34-
</SimpleForm>
35-
</Card>
36-
</div>
23+
<div>
24+
<Title title="Book Creation" />
25+
<Card>
26+
<SimpleForm>
27+
<TextInput source="title" />
28+
<TextInput source="author" />
29+
<SelectInput source="availability" choices={[
30+
{ id: "in_stock", name: "In stock" },
31+
{ id: "out_of_stock", name: "Out of stock" },
32+
{ id: "out_of_print", name: "Out of print" },
33+
]} />
34+
</SimpleForm>
35+
</Card>
36+
</div>
3737
</CreateBase>
38-
);
39-
};
38+
);
4039
```
4140

4241
You can customize the `<CreateBase>` component using the following props, documented in the `<Create>` component:

docs/EditBase.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,24 @@ import * as React from "react";
1818
import { EditBase, SimpleForm, TextInput, SelectInput } from "react-admin";
1919
import { Card } from "@mui/material";
2020

21-
export const BookEdit = () => {
21+
export const BookEdit = () => (
2222
<EditBase>
23-
<div>
24-
<Title title="Book Edition" />
25-
<Card>
26-
<SimpleForm>
27-
<TextInput source="title" />
28-
<TextInput source="author" />
29-
<SelectInput source="availability" choices={[
30-
{ id: "in_stock", name: "In stock" },
31-
{ id: "out_of_stock", name: "Out of stock" },
32-
{ id: "out_of_print", name: "Out of print" },
33-
]} />
34-
</SimpleForm>
35-
</Card>
36-
</div>
23+
<div>
24+
<Title title="Book Edition" />
25+
<Card>
26+
<SimpleForm>
27+
<TextInput source="title" />
28+
<TextInput source="author" />
29+
<SelectInput source="availability" choices={[
30+
{ id: "in_stock", name: "In stock" },
31+
{ id: "out_of_stock", name: "Out of stock" },
32+
{ id: "out_of_print", name: "Out of print" },
33+
]} />
34+
</SimpleForm>
35+
</Card>
36+
</div>
3737
</EditBase>
38-
);
39-
};
38+
);
4039
```
4140

4241
You can customize the `<EditBase>` component using the following props, documented in the `<Edit>` component:

docs/EditLive.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ To trigger `<EditLive>` features, the API has to publish events containing at le
3232
{
3333
topic : '/resource/{resource}/{recordIdentifier}',
3434
type: '{deleted || updated}',
35-
payload: { id: [{recordIdentifier}]},
35+
payload: { id: [{ recordIdentifier }]},
3636
}
3737
```
3838

docs/Features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ And last but not least, react-admin provides a **lock mechanism** to prevent two
10961096

10971097
A user can lock a resource, either by voluntarily asking for a lock or by editing a resource. When a resource is locked, other users can't edit it. When the lock is released, other users can edit the resource again.
10981098

1099-
```jsx
1099+
```tsx
11001100
export const NewMessageForm = () => {
11011101
const [create, { isLoading: isCreating }] = useCreate();
11021102
const record = useRecordContext();

docs/FilteringTutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export const PostFilterSidebar = () => (
165165
<Card sx={{ order: -1, mr: 2, mt: 9, width: 200 }}>
166166
<CardContent>
167167
<SavedQueriesList />
168-
<FilterLiveSearch >
168+
<FilterLiveSearch />
169169
<FilterList label="Subscribed to newsletter" icon={<MailIcon />}>
170170
<FilterListItem label="Yes" value={{ has_newsletter: true }} />
171171
<FilterListItem label="No" value={{ has_newsletter: false }} />

0 commit comments

Comments
 (0)