Skip to content

Commit f8f8465

Browse files
committed
remove mui components from ReferenceOneFieldBase doc.
1 parent 9dbb604 commit f8f8465

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

docs/ReferenceOneFieldBase.md

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,11 @@ Here is how to render a field of the `book_details` resource inside a Show view
3232
```jsx
3333

3434
const BookShow = () => (
35-
<Show>
36-
<SimpleShowLayout>
37-
<TextField source="title" />
38-
<DateField source="published_at" />
39-
<ReferenceField source="authorId" reference="authors" />
40-
<ReferenceOneFieldBase reference="book_details" target="book_id">
41-
<BookDetails />
42-
</ReferenceOneFieldBase>
43-
</SimpleShowLayout>
44-
</Show>
35+
<ShowBase>
36+
<ReferenceOneFieldBase reference="book_details" target="book_id">
37+
<BookDetails />
38+
</ReferenceOneFieldBase>
39+
</ShowBase>
4540
);
4641

4742
// with BookDetails something like
@@ -156,15 +151,15 @@ Use `empty` to customize the text displayed when the related record is empty.
156151

157152
```jsx
158153
<ReferenceOneFieldBase label="Details" reference="book_details" target="book_id" empty="no detail">
159-
<TextField source="genre" /> (<TextField source="ISBN" />)
154+
...
160155
</ReferenceOneFieldBase>
161156
```
162157

163158
`empty` also accepts a translation key.
164159

165160
```jsx
166161
<ReferenceOneFieldBase label="Details" reference="book_details" target="book_id" empty="resources.books.not_found">
167-
<TextField source="genre" /> (<TextField source="ISBN" />)
162+
...
168163
</ReferenceOneFieldBase>
169164
```
170165

@@ -177,7 +172,7 @@ Use `empty` to customize the text displayed when the related record is empty.
177172
target="book_id"
178173
empty={<CreateButton to="/book_details/create" />}
179174
>
180-
<TextField source="genre" /> (<TextField source="ISBN" />)
175+
...
181176
</ReferenceOneFieldBase>
182177
```
183178

@@ -194,7 +189,7 @@ For instance, if a product has prices in many currencies, and you only want to r
194189
target="product_id"
195190
filter={{ currency: "EUR" }}
196191
>
197-
<NumberField source="price" />
192+
...
198193
</ReferenceOneFieldBase>
199194
```
200195
{% endraw %}
@@ -205,7 +200,7 @@ By default, `<ReferenceOneFieldBase>` will set pass a links to the edition page
205200

206201
```jsx
207202
<ReferenceOneFieldBase label="Genre" reference="book_details" target="book_id" link={false}>
208-
<TextField source="genre" />
203+
...
209204
</ReferenceOneFieldBase>
210205
```
211206

@@ -218,7 +213,7 @@ You can also set the `link` prop to a string, which will be used as the link typ
218213
target="book_id"
219214
link={record => `/custom/${record.id}`}
220215
>
221-
<TextField source="genre" />
216+
...
222217
</ReferenceOneFieldBase>
223218
```
224219
{% endraw %}
@@ -237,7 +232,7 @@ For instance, if you want to disable the refetch on window focus for this query,
237232
target="book_id"
238233
queryOptions={{ refetchOnWindowFocus: false }}
239234
>
240-
<TextField source="genre" />
235+
...
241236
</ReferenceOneFieldBase>
242237
```
243238
{% endraw %}
@@ -250,7 +245,7 @@ For instance, if you want to display the details of a given book, the `reference
250245

251246
```jsx
252247
<ReferenceOneFieldBase label="Genre" reference="book_details" target="book_id">
253-
<TextField source="genre" />
248+
...
254249
</ReferenceOneFieldBase>
255250
```
256251

@@ -269,7 +264,7 @@ For instance, if you want to display the latest message in a discussion, you can
269264
target="discussion_id"
270265
sort={{ field: "createdAt", order: "DESC" }}
271266
>
272-
<TextField source="body" />
267+
...
273268
</ReferenceOneFieldBase>
274269
```
275270
{% endraw %}
@@ -295,6 +290,6 @@ In that case, the `target` prop should be set to `book_id`:
295290

296291
```jsx
297292
<ReferenceOneFieldBase label="Genre" reference="book_details" target="book_id">
298-
<TextField source="genre" />
293+
...
299294
</ReferenceOneFieldBase>
300295
```

0 commit comments

Comments
 (0)