Skip to content

Commit 9358f22

Browse files
Chore(tips): Sync tips from tips repository
1 parent da9499b commit 9358f22

File tree

2 files changed

+74
-17
lines changed

2 files changed

+74
-17
lines changed

docs/assets/features.md_ignore

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The `<ToggleThemeButton>` component lets users switch from light to dark mode, a
2424

2525
If you need horizontal space, switch the classic menu for an `<IconMenu>`. It renders a reduced menu bar with a sliding panel for second-level menu items. This menu saves a lot of screen real estate, and allows for sub menus of any level of complexity. #UI https://marmelab.com/react-admin/IconMenu.html
2626

27-
![IconMenu](https://react-admin-ee.marmelab.com/assets/ra-multilevelmenu-categories.gif)
27+
![IconMenu](https://marmelab.com/ra-enterprise/modules/assets/ra-multilevelmenu-categories.gif)
2828

2929
---
3030

@@ -54,7 +54,7 @@ When a form becomes too complex, organize the inputs in different sections with
5454

5555
To provide users visibility on their progression through a complex form, use the `<WizardForm>`. #form https://marmelab.com/react-admin/WizardForm.html
5656

57-
![WizardForm](https://react-admin-ee.marmelab.com/assets/ra-wizard-form-overview.gif)
57+
![WizardForm](https://marmelab.com/ra-enterprise/modules/assets/ra-wizard-form-overview.gif)
5858

5959
---
6060

@@ -118,7 +118,7 @@ With your admin getting bigger, or if you have to manage many resources and/or s
118118

119119
<video controls autoplay playsinline muted loop width="100%">
120120
<source
121-
src="https://react-admin-ee.marmelab.com/assets/breadcumb-nested-resource.mp4"
121+
src="https://marmelab.com/ra-enterprise/modules/assets/ra-navigation/latest/breadcumb-nested-resource.webm"
122122
type="video/webm"
123123
/>
124124
Your browser does not support the video tag.
@@ -177,7 +177,8 @@ Edition forms in react-admin have a built-in "Undo" feature, letting end users c
177177
`<Edit>` is designed to be a page component, passed to the edit prop of the `<Resource>` component. But you may want to let users edit a record in a dialiog without leaving the context of the list page. If so, you can use the `<EditDialog>` component. #form https://marmelab.com/react-admin/EditDialog.html
178178

179179
<video controls autoplay playsinline muted loop>
180-
<source src="https://react-admin-ee.marmelab.com/assets/edit-dialog.mp4" type="video/mp4">
180+
<source src="https://marmelab.com/ra-enterprise/modules/assets/edit-dialog.webm" type="video/webm">
181+
<source src="https://marmelab.com/ra-enterprise/modules/assets/edit-dialog.mp4" type="video/mp4">
181182
Your browser does not support the video tag.
182183
</video>
183184

@@ -186,7 +187,8 @@ Edition forms in react-admin have a built-in "Undo" feature, letting end users c
186187
If you want to let users edit a record from another page, use the `<EditInDialogButton>` component. #form https://marmelab.com/react-admin/EditInDialogButton.html
187188

188189
<video controls autoplay playsinline muted loop>
189-
<source src="https://react-admin-ee.marmelab.com/assets/ra-form-layout/latest/InDialogButtons.mp4" type="video/mp4">
190+
<source src="https://marmelab.com/ra-enterprise/modules/assets/ra-form-layout/latest/InDialogButtons.webm" type="video/webm">
191+
<source src="https://marmelab.com/ra-enterprise/modules/assets/ra-form-layout/latest/InDialogButtons.mp4" type="video/mp4">
190192
Your browser does not support the video tag.
191193
</video>
192194

@@ -215,7 +217,8 @@ Use `<ReferenceOneInput>` in an `<Edit>` or `<Create>` view to edit a record lin
215217
The `<Search>` component renders a global search input. It’s designed to be always accessible in the top `<AppBar>`. #ui https://marmelab.com/react-admin/Search.html
216218

217219
<video controls autoplay playsinline muted loop>
218-
<source src="https://react-admin-ee.marmelab.com/assets/ra-search-demo.mp4" type="video/mp4">
220+
<source src="https://marmelab.com/ra-enterprise/modules/assets/ra-search-demo.webm" type="video/webm">
221+
<source src="https://marmelab.com/ra-enterprise/modules/assets/ra-search-demo.mp4" type="video/mp4">
219222
Your browser does not support the video tag.
220223
</video>
221224

@@ -234,7 +237,8 @@ The `<Configurable>` component makes another component configurable by the end u
234237
In the case you want keep track of user actions, and get an overview of the activity of your admin, you can display event lists and audit logs with `<TimeLine>`, `<RecordTimeline>` and with `<EventList>` components. #activitylog #timeline #eventlog https://marmelab.com/ra-enterprise/modules/ra-audit-log
235238

236239
<video controls autoplay playsinline muted loop>
237-
<source src="https://react-admin-ee.marmelab.com/assets/ra-audit-log/latest/ra-audit-log-event-list.mp4" type="video/mp4">
240+
<source src="https://marmelab.com/ra-enterprise/modules/assets/ra-audit-log/latest/ra-audit-log-event-list.webm" type="video/webm">
241+
<source src="https://marmelab.com/ra-enterprise/modules/assets/ra-audit-log/latest/ra-audit-log-event-list.mp4" type="video/mp4">
238242
Your browser does not support the video tag.
239243
</video>
240244

@@ -252,7 +256,7 @@ To show more data from a resource without adding too many columns, you can show
252256
With your admin getting bigger, the default sidebar menu might become too crowded. The `SolarLayout` is a beautiful alternative layout that help you organize your pages. #ui
253257

254258
<video controls autoplay playsinline muted loop>
255-
<source src="https://react-admin-ee.marmelab.com/assets/ra-solar-layout.mp4" type="video/mp4">
259+
<source src="https://marmelab.com/ra-enterprise/modules/assets/ra-solar-layout.mp4" type="video/mp4">
256260
Your browser does not support the video tag.
257261
</video>
258262

@@ -261,7 +265,8 @@ With your admin getting bigger, the default sidebar menu might become too crowde
261265
If your app needs to display **events**, **appointments**, **time intervals**, or any other kind of time-based data, you can use the `<Calendar>` component. #ui https://marmelab.com/react-admin/Calendar.html
262266

263267
<video controls autoplay playsinline muted loop>
264-
<source src="https://react-admin-ee.marmelab.com/assets/ra-calendar.mp4" type="video/mp4">
268+
<source src="https://marmelab.com/ra-enterprise/modules/assets/ra-calendar.webm" type="video/webm">
269+
<source src="https://marmelab.com/ra-enterprise/modules/assets/ra-calendar.mp4" type="video/mp4">
265270
Your browser does not support the video tag.
266271
</video>
267272

@@ -279,7 +284,8 @@ If your app needs to display **events**, **appointments**, **time intervals**, o
279284
The `<SearchWithResult>` component renders a search input and the search results directly below the input. It's ideal for dashboards or menu panels. #ui #search https://marmelab.com/ra-enterprise/modules/ra-search#searchwithresult
280285

281286
<video controls autoplay playsinline muted loop>
282-
<source src="https://react-admin-ee.marmelab.com/assets/ra-search-with-result-overview.mp4" type="video/mp4">
287+
<source src="https://marmelab.com/ra-enterprise/modules/assets/ra-search-with-result-overview.webm" type="video/webm">
288+
<source src="https://marmelab.com/ra-enterprise/modules/assets/ra-search-with-result-overview.mp4" type="video/mp4">
283289
Your browser does not support the video tag.
284290
</video>
285291

docs/assets/tips.md_ignore

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ With `<Datagrid>`, you can select a range of rows by pressing the shift key whil
10011001
---
10021002

10031003
If you need to customize the `<SolarLayout>` appBar that appears on Mobile, you can set the `appBar` prop of `<SolarLayout>`. For instance, here's how you could customize its colors and add some extra content to its far right.
1004-
#SolarLayout https://react-admin-ee.marmelab.com/documentation/ra-navigation#appbar-1
1004+
#SolarLayout https://marmelab.com/ra-enterprise/modules/ra-navigation#appbar-1
10051005

10061006
{% raw %}
10071007
```tsx
@@ -1226,6 +1226,34 @@ export const PostList = () => (
12261226

12271227
---
12281228

1229+
The `canAccess` helper function allows you to check if the current user has the permissions to execute an action. You can use it to disable desired links on a menu for instance. #Role-Based-Access-Control #RBAC https://marmelab.com/ra-enterprise/modules/ra-rbac#canaccess
1230+
1231+
```tsx
1232+
import { usePermissions, Menu } from "react-admin";
1233+
import { canAccess } from "@react-admin/ra-rbac";
1234+
1235+
const MyMenu = () => {
1236+
const { permissions } = usePermissions();
1237+
return (
1238+
<Menu>
1239+
<Menu.DashboardItem />
1240+
<Menu.Item
1241+
to="/categories"
1242+
primaryText="Categories"
1243+
disabled={
1244+
!canAccess({
1245+
permissions,
1246+
resource: "categories",
1247+
})
1248+
}
1249+
/>
1250+
</Menu>
1251+
);
1252+
};
1253+
```
1254+
1255+
---
1256+
12291257
If you render more than one `<DatagridConfigurable>` on the same page, you must pass a unique preferenceKey prop to each one. Do not forget to link their `<SelectColumnsButton>` components by giving them the same preferenceKey. #datagrid https://marmelab.com/react-admin/Datagrid.html#configurable
12301258

12311259
{% raw %}
@@ -2000,18 +2028,41 @@ You can add custom CSS classes to any column or cell in `DatagridAG` or `Datagri
20002028
{% raw %}
20012029
```tsx
20022030
const columnDefs = [
2003-
{ field: 'static', cellClass: 'my-class' },
2004-
{ field: 'staticArray', cellClass: ['my-class1','my-class2'] },
2005-
{ field: 'function', cellClass: params => params.value === 'something' ? 'my-class-1' : 'my-class-2' },
2006-
{ field: 'functionArray', cellClass: params => ['my-class-1','my-class-2'] },
2031+
// return same class for each row
2032+
{
2033+
field: 'static',
2034+
cellClass: 'my-class'
2035+
},
2036+
// return same array of classes for each row
2037+
{
2038+
field: 'staticArray',
2039+
cellClass: ['my-class1','my-class2'],
2040+
},
2041+
// return class based on function
2042+
{
2043+
field: 'function',
2044+
cellClass: params => {
2045+
return params.value === 'something' ? 'my-class-1' : 'my-class-2';
2046+
},
2047+
},
2048+
// return array of classes based on function
2049+
{
2050+
field: 'functionArray',
2051+
cellClass: params => ['my-class-1','my-class-2'],
2052+
},
2053+
// return array of classes based on many functions with `cellClassRules`
20072054
{
20082055
field: 'functionRules',
20092056
cellClassRules: {
2057+
// apply green to 2008
20102058
'rag-green-outer': params => params.value === 2008,
2059+
// apply blue to 2004
20112060
'rag-blue-outer': params => params.value === 2004,
2061+
// apply red to 2000
20122062
'rag-red-outer': params => params.value === 2000,
20132063
}
2014-
},
2064+
}
2065+
// return array of classes based on many functions with `cellClassRules`
20152066
{
20162067
field: 'simplifiedFunctionRules',
20172068
cellClassRules: {
@@ -2024,4 +2075,4 @@ const columnDefs = [
20242075
```
20252076
{% endraw %}
20262077

2027-
https://www.ag-grid.com/react-data-grid/cell-styles
2078+
https://www.ag-grid.com/react-data-grid/cell-styles

0 commit comments

Comments
 (0)