Skip to content

Commit 9bc8a0d

Browse files
committed
docs(website): Updated general documentation
1 parent d98bf51 commit 9bc8a0d

File tree

3 files changed

+39
-50
lines changed

3 files changed

+39
-50
lines changed

packages/documentation/src/guides/configuring-your-layout.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,25 @@ render(
4646

4747
This component will initialize:
4848

49+
- `Dir` - see #utils
4950
- `AppSizeListener` - see #utils
50-
- `InteractionModeListener` - see #utils
51-
- `HoverModeProvider` - see #utils
52-
- `StatesConfig` - see #states
5351
- `NestedDialogContextProvider` - see #dialog
52+
- `UserInteractionModeListener` - see #utils
53+
- `StatesConfig` - see #utils
54+
- `HoverModeProvider` - see #utils
55+
- `IconProvider` - see #icons
56+
- `FormThemeProvider` - see #form
5457

5558
The three most important Providers that are included are the `AppSizeListener`,
56-
`InteractionModeListener` and `StatesConfig`. The `AppSizeListener` is in the
57-
#utils package that helps determine how your app is being viewed based on media
58-
queries. The `InteractionModeListener` also comes from the #utils package and
59-
helps determine if your app is being interacted by touch, mouse, or keyboard to
60-
customize the styles for that experience. Finally, the `StatesConfig` is the
61-
general configuration for how different interactable elements gain different
62-
states based on the interaction mode. This also globally controls the "ripple"
63-
effect when elements are clicked so allows for a quick opt-out if you don't like
64-
that effect.
59+
`UserInteractionModeListener`, and `StatesConfig`. The `AppSizeListener` is in
60+
the #utils package that helps determine how your app is being viewed based on
61+
media queries. The `UserInteractionModeListener` also comes from the #utils
62+
package and helps determine if your app is being interacted by touch, mouse, or
63+
keyboard to customize the styles for that experience. Finally, the
64+
`StatesConfig` is the general configuration for how different interactable
65+
elements gain different states based on the interaction mode. This also globally
66+
controls the "ripple" effect when elements are clicked so allows for a quick
67+
opt-out if you don't like that effect.
6568

6669
## Creating a Layout
6770

packages/documentation/src/guides/writing-tests.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
## Writing Tests
22

3-
Testing with `react-md` should not much more difficult than any other component
4-
testing you are used to for the majority of your tests. The only times you might
5-
encounter errors are when you use components that rely one one of the
6-
configuration providers and determining the current app size. Since I am the
7-
most familiar with [jest] as the test runner and [react-testing-library] as the
8-
test renderer, this guide will be targeted towards these two libraries
3+
Testing an app with `react-md` components should not require many changes to
4+
your normal testing flow. The only times weird issues might occur are when using
5+
components that rely on one of the providers included by the [Configuration
6+
component].
7+
8+
This guide will provide a few suggestions for setting up an app with [jest] and
9+
[react-testing-library].
910

1011
### Initializing window.matchMedia
1112

12-
If one of your components or a component from `react-md` uses the `useAppSize`
13-
or `useMediaQuery` hooks, your tests might fail due to `window.matchMedia` being
13+
If a component from your app or `react-md` uses the `useAppSize` or
14+
`useMediaQuery` hooks, your tests might fail due to `window.matchMedia` being
1415
`undefined`. In this case, you'll want to create or update a `testSetup.ts` (or
1516
`testSetup.js`) to include a very simple polyfill.
1617

1718
Edit `testSetup.ts`:
1819

1920
```diff
20-
+const {
21+
+import {
2122
+ DEFAULT_DESKTOP_MIN_WIDTH,
2223
+ DEFAULT_DESKTOP_LARGE_MIN_WIDTH,
23-
+} = require('@react-md/utils/lib/sizing/constants');
24+
+} from '@react-md/utils';
2425
+
2526
+if (typeof window.matchMedia !== 'function') {
2627
+ window.matchMedia = (query) => ({
@@ -49,7 +50,7 @@ Edit `jest.config.js`:
4950
}
5051
```
5152

52-
This default polyfill will make all your tests run in desktop mode by default.
53+
This polyfill will make all your tests run in desktop mode by default.
5354

5455
### Testing different app sizes
5556

@@ -140,3 +141,4 @@ Edit `src/components/__tests__/Component.tsx`:
140141
https://testing-library.com/docs/react-testing-library/intro
141142
[custom renderer]:
142143
https://testing-library.com/docs/react-testing-library/setup#custom-render
144+
[configuration component]: /guides/configuring-your-app

packages/utils/README.md

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,23 @@ generating styles for packages that have been installed.
88

99
Check out the usage section below for more details.
1010

11-
Exported components:
12-
13-
- `AppSizeListener`
14-
- `ResizeListener`
15-
- `ResizeObserver`
16-
- `ScrollListener`
17-
- `MobileOnly`
18-
- `PhoneOnly`
19-
- `TabletOnly`
20-
- `DesktopOnly`
21-
- `FocusContainer`
22-
23-
Export hooks:
24-
25-
- `useAppSize`
26-
- `useMediaQuery`
27-
- `useOrientation`
28-
- `useResizeListener`
29-
- `useResizeObserver`
30-
- `useCloseOnEscape`
31-
- `useFocusOnMount`
32-
- `useKeyboardMovement`
33-
- `useKeyboardSearch`
34-
- `usePreviousFocus`
35-
- `useScrollLock`
36-
- `useTabFocusWrap`
37-
3811
## Installation
3912

4013
```sh
4114
npm install --save @react-md/utils
4215
```
4316

17+
<!-- DOCS_REMOVE -->
18+
19+
## Documentation
20+
21+
You should check out the
22+
[full documentation](https://react-md.dev/packages/utils/demos) for live
23+
examples and more customization information, but an example usage is shown
24+
below.
25+
26+
<!-- DOCS_REMOVE_END -->
27+
4428
## Usage
4529

4630
The main export for this package will mainly be the exposed mixins which can be

0 commit comments

Comments
 (0)