Skip to content

Commit

Permalink
chore(docs): Updated documentation site for new HoverModeProvider doc…
Browse files Browse the repository at this point in the history
…umentation
  • Loading branch information
mlaursen committed Apr 18, 2021
1 parent 357f2bf commit f42c65c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ and the initial hover delay will be used again. This feature is actually enabled
throughout the app but disabled for these demos to help show the default tooltip
behavior.

To hook into the hover mode, all you need to do is use the
`TooltipHoverModeConfig` component as a parent of all the elements that have
tooltips. The component can either be at the root of your app, or a small
section so that only a few tooltips are "linked together" with this hover mode
flow.
To hook into the hover mode, all you need to do is use the `HoverModeProvider`
component from #utils as a parent of all the elements that have tooltips. The
component can either be at the root of your app, or a small section so that only
a few tooltips are "linked together" with this hover mode flow.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, { ReactElement } from "react";
import { TooltipHoverModeConfig, Tooltipped } from "@react-md/tooltip";
import { Tooltipped } from "@react-md/tooltip";
import { Button } from "@react-md/button";
import { HoverModeProvider } from "@react-md/utils";

import Container from "./Container";

export default function HoverMode(): ReactElement {
return (
<TooltipHoverModeConfig>
<HoverModeProvider>
<Container>
{Array.from({ length: 8 }).map((_, i) => (
<Tooltipped
Expand All @@ -18,6 +19,6 @@ export default function HoverMode(): ReactElement {
</Tooltipped>
))}
</Container>
</TooltipHoverModeConfig>
</HoverModeProvider>
);
}
6 changes: 2 additions & 4 deletions packages/documentation/src/components/Demos/Tooltip/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { ReactElement } from "react";
import { TooltipHoverModeConfig } from "@react-md/tooltip";
import { HoverModeProvider } from "@react-md/utils";

import DemoPage from "../DemoPage";

Expand Down Expand Up @@ -69,9 +69,7 @@ const demos = [
...demo,
// remove the global tooltip hover mode config from all demos since it'll
// manually be applied in a specific demo instead
children: (
<TooltipHoverModeConfig enabled={false}>{children}</TooltipHoverModeConfig>
),
children: <HoverModeProvider disabled>{children}</HoverModeProvider>,
}));

export default function Tooltip(): ReactElement {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ This component will initialize:

- `AppSizeListener` - see #utils
- `InteractionModeListener` - see #utils
- `HoverModeProvider` - see #utils
- `StatesConfig` - see #states
- `NestedDialogContextProvider` - see #dialog
- `TooltipHoverModeConfig` - see #tooltip

The three most important Providers that are included are the `AppSizeListener`,
`InteractionModeListener` and `StatesConfig`. The `AppSizeListener` is in the
Expand Down

0 comments on commit f42c65c

Please sign in to comment.